Module is.codion.framework.domain
Interface ValueAttributeDefinition<T>
- Type Parameters:
T- the value type
- All Superinterfaces:
AttributeDefinition<T>
- All Known Subinterfaces:
ColumnDefinition<T>,DerivedAttributeDefinition<T>,TransientAttributeDefinition<T>
public sealed interface ValueAttributeDefinition<T>
extends AttributeDefinition<T>
permits ColumnDefinition<T>, DerivedAttributeDefinition<T>, TransientAttributeDefinition<T> (not exhaustive)
Defines an Attribute that holds concrete values (String, Integer, BigDecimal, etc.)
requiring type-specific validation, formatting, and constraints.
Contrast with ForeignKeyDefinition which holds Entity references and delegates
formatting to the referenced entity's stringFactory.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds a ValueAttributeDefinition instanceNested classes/interfaces inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition
AttributeDefinition.ValueSupplier<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Character> Specifies the default number decimal separator.static final intThe default maximum fraction digits for floating point numbersstatic final PropertyValue<Integer> Specifies the default maximum number of fraction digits for double property values
Note that values are rounded when set.static final PropertyValue<Character> Specifies the default number grouping separator Value type: Character Default value: The grouping separator for the default localestatic final PropertyValue<Boolean> Specifies whether number grouping is used by default Value type: Boolean Default value: falsestatic final PropertyValue<RoundingMode> Specifies the default rounding mode used for decimal property values Value type:RoundingModeDefault value:RoundingMode.HALF_EVENstatic final PropertyValue<Boolean> Specifies whether String values should be trimmed by default Value type: Boolean Default value: truestatic final PropertyValue<Boolean> Specifies whether String values should use a lexical comparator by default Value type: Boolean Default value: trueFields inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition
DESCRIPTION_RESOURCE_SUFFIX, MNEMONIC_RESOURCE_SUFFIX -
Method Summary
Modifier and TypeMethodDescriptionReturns the date time formatter used when presenting and inputting values for this attribute.Returns the date time format pattern used when presenting and inputting values for this attribute.booleanderived()The value of a derived attribute can not be set, as it's value is derived from other valuesformat()Returns the Format used when presenting values for this attribute, an empty Optional if none has been specified.intitems()Returns the valid items for this attribute or an empty list in case this is not an item based attributemaximum()intminimum()booleantrim()booleanValidates the given value against the valid items for this attribute.Methods inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition
attribute, caption, comparator, defaultValue, description, entityType, format, hasDefaultValue, hidden, mnemonic, nullable, validate, validate
-
Field Details
-
DEFAULT_FRACTION_DIGITS
static final int DEFAULT_FRACTION_DIGITSThe default maximum fraction digits for floating point numbers- See Also:
-
FRACTION_DIGITS
Specifies the default maximum number of fraction digits for double property values
Note that values are rounded when set.- Value type: Integer
- Default value: 10
-
ROUNDING_MODE
Specifies the default rounding mode used for decimal property values- Value type:
RoundingMode - Default value:
RoundingMode.HALF_EVEN
- See Also:
- Value type:
-
NUMBER_GROUPING
Specifies whether number grouping is used by default- Value type: Boolean
- Default value: false
-
GROUPING_SEPARATOR
Specifies the default number grouping separator- Value type: Character
- Default value: The grouping separator for the default locale
-
DECIMAL_SEPARATOR
Specifies the default number decimal separator.- Value type: Character
- Default value: The decimal separator for the default locale
-
USE_LEXICAL_STRING_COMPARATOR
Specifies whether String values should use a lexical comparator by default- Value type: Boolean
- Default value: true
-
TRIM_STRINGS
Specifies whether String values should be trimmed by default- Value type: Boolean
- Default value: true
- See Also:
-
-
Method Details
-
maximum
- Returns:
- the maximum allowed value for this attribute, an empty Optional if none is defined, only applicable to numerical attributes
-
minimum
- Returns:
- the minimum allowed value for this attribute, an empty Optional if none is defined, only applicable to numerical attributes
-
fractionDigits
int fractionDigits()- Returns:
- the maximum number of fraction digits to use for this attribute value, -1 if this attribute is not based on Types.DOUBLE or Types.DECIMAL
- See Also:
-
roundingMode
RoundingMode roundingMode()- Returns:
- the rounding mode to use when working with decimal values
- See Also:
-
maximumLength
int maximumLength()- Returns:
- the maximum length of this attribute value, -1 is returned if the maximum length is undefined, this only applies to String (varchar) based attributes
-
trim
boolean trim()- Returns:
- if string values should be trimmed, this applies to String (varchar) based attributes
-
format
Returns the Format used when presenting values for this attribute, an empty Optional if none has been specified.- Returns:
- the Format object used to format the value of attributes when being presented
-
dateTimePattern
Returns the date time format pattern used when presenting and inputting values for this attribute.- Returns:
- the date/time format pattern
-
dateTimeFormatter
Optional<DateTimeFormatter> dateTimeFormatter()Returns the date time formatter used when presenting and inputting values for this attribute.- Returns:
- the DateTimeFormatter for this attribute or an empty Optional if this is not a date/time based attribute
-
validItem
Validates the given value against the valid items for this attribute. Always returns true if this is not an item based attribute.- Parameters:
value- the value to validate- Returns:
- true if the given value is a valid item for this attribute
- See Also:
-
items
Returns the valid items for this attribute or an empty list in case this is not an item based attribute- Returns:
- an unmodifiable view of the valid items for this attribute
-
derived
boolean derived()The value of a derived attribute can not be set, as it's value is derived from other values- Returns:
- true if the value of this attribute is derived from one or more values
-