Module is.codion.framework.domain
Interface ValueAttributeDefinition.Builder<T,B extends ValueAttributeDefinition.Builder<T,B>>
- Type Parameters:
T- the value typeB- the builder type
- All Superinterfaces:
AttributeDefinition.Builder<T,B>
- All Known Subinterfaces:
ColumnDefinition.Builder<T,,B> DerivedAttributeDefinition.DenormalizedBuilder<T,,B> DerivedAttributeDefinition.DerivedBuilder<T,,B> TransientAttributeDefinition.Builder<T,B>
- Enclosing interface:
ValueAttributeDefinition<T>
public static sealed interface ValueAttributeDefinition.Builder<T,B extends ValueAttributeDefinition.Builder<T,B>>
extends AttributeDefinition.Builder<T,B>
permits ColumnDefinition.Builder<T,B>, DerivedAttributeDefinition.DerivedBuilder<T,B>, DerivedAttributeDefinition.DenormalizedBuilder<T,B>, TransientAttributeDefinition.Builder<T,B> (not exhaustive)
Builds a ValueAttributeDefinition instance
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new attribute definition instancedateTimePattern(LocaleDateTimePattern dateTimePattern) Sets the locale aware date/time format pattern used when presenting and inputting valuesdateTimePattern(String dateTimePattern) Sets the date/time format pattern used when presenting and inputtind valuesSets the Format to use when presenting attribute valuesfractionDigits(int fractionDigits) Sets the maximum fraction digits to show for this attribute, only applicable to attributes based on decimal types.Note that by default items are sorted by to their caption, not their value.Only applicable to numerical attributesmaximumLength(int maximumLength) Sets the maximum length of this attribute value, this applies to String (varchar) based attributesOnly applicable to numerical attributesnumberGrouping(boolean numberGrouping) Specifies whether to use number grouping when presenting the value associated with this attribute.Only applicable to numerical attributesroundingMode(RoundingMode roundingMode) Sets the rounding mode to use when working with decimalstrim(boolean trim) Specifies whether string values should be trimmed, this applies to String (varchar) based attributes.Methods inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition.Builder
attribute, caption, captionResource, captionResource, comparator, defaultValue, defaultValue, description, descriptionResource, descriptionResource, hidden, mnemonic, mnemonicResource, mnemonicResource, nullable
-
Method Details
-
minimum
Only applicable to numerical attributes- Parameters:
minimum- the minimum allowed value for this attribute- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a numerical attribute
-
maximum
Only applicable to numerical attributes- Parameters:
maximum- the maximum allowed value for this attribute- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a numerical attribute
-
range
Only applicable to numerical attributes- Parameters:
minimum- the minimum allowed value for this attributemaximum- the maximum allowed value for this attribute- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a numerical attribute
-
maximumLength
Sets the maximum length of this attribute value, this applies to String (varchar) based attributes- Parameters:
maximumLength- the maximum length- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a String attribute
-
fractionDigits
Sets the maximum fraction digits to show for this attribute, only applicable to attributes based on decimal types. This setting is overridden during subsequent calls toformat(Format). Note that values associated with this attribute are automatically rounded toValueAttributeDefinition.fractionDigits()digits.- Parameters:
fractionDigits- the maximum fraction digits- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a decimal attribute- See Also:
-
roundingMode
Sets the rounding mode to use when working with decimals- Parameters:
roundingMode- the rounding mode- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a decimal attribute- See Also:
-
numberGrouping
Specifies whether to use number grouping when presenting the value associated with this attribute. i.e. 1234567 shown as 1.234.567 or 1,234,567 depending on locale. By default, grouping is not used. Only applicable to numerical attributes. This setting is overridden during subsequent calls toformat(Format)- Parameters:
numberGrouping- if true then number grouping is used- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a numerical attribute
-
format
Sets the Format to use when presenting attribute values- Parameters:
format- the format to use- Returns:
- this builder instance
- Throws:
NullPointerException- in case format is nullIllegalArgumentException- in case this is a numerical attribute and the given format is not a NumberFormat.IllegalStateException- if the underlying attribute is temporal, in which casedateTimePattern(String)ordateTimePattern(LocaleDateTimePattern)should be used.
-
dateTimePattern
Sets the date/time format pattern used when presenting and inputtind values- Parameters:
dateTimePattern- the format pattern- Returns:
- this builder instance
- Throws:
IllegalArgumentException- in case the pattern is invalidIllegalStateException- in case this is not a temporal attributeIllegalStateException- in casedateTimePattern(LocaleDateTimePattern)has been set
-
dateTimePattern
Sets the locale aware date/time format pattern used when presenting and inputting values- Parameters:
dateTimePattern- the format pattern- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a temporal attributeIllegalStateException- in casedateTimePattern(String)has been set
-
trim
Specifies whether string values should be trimmed, this applies to String (varchar) based attributes.- Parameters:
trim- true if strings values should be trimmed- Returns:
- this builder instance
- Throws:
IllegalStateException- in case this is not a String attribute- See Also:
-
items
Note that by default items are sorted by to their caption, not their value. UseAttributeDefinition.Builder.comparator(java.util.Comparator)to set a custom comparator.- Parameters:
items- theItems representing all the valid values for this attribute- Returns:
- this builder instance
- Throws:
IllegalArgumentException- in case the valid item list contains duplicate values
-
build
ValueAttributeDefinition<T> build()Description copied from interface:AttributeDefinition.BuilderBuilds a new attribute definition instance- Specified by:
buildin interfaceAttributeDefinition.Builder<T,B extends ValueAttributeDefinition.Builder<T, B>> - Returns:
- a new attribute definition instance based on this builder
-