Interface ValueAttributeDefinition<T>
- Type Parameters:
T- the value type
- All Superinterfaces:
AttributeDefinition<T>
- All Known Subinterfaces:
ColumnDefinition<T>, TransientAttributeDefinition<T>
public sealed interface ValueAttributeDefinition<T>
extends AttributeDefinition<T>
permits ColumnDefinition<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 formatter.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds a ValueAttributeDefinition instanceNested classes/interfaces inherited from interface AttributeDefinition
AttributeDefinition.DefaultValue<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Boolean> Specifies whether String values should be trimmed by default Value type: Boolean Default value: trueFields inherited from interface AttributeDefinition
DECIMAL_SEPARATOR, FRACTION_DIGITS, GROUPING_SEPARATOR, LEXICAL_STRING_COMPARATOR, NUMBER_GROUPING, ROUNDING_MODE -
Method Summary
Modifier and TypeMethodDescriptionbooleanitems()Returns the valid items for this attribute or an empty list in case this is not an item based attributemaximum()intminimum()booleannullable()booleantrim()voidValidates the value of this attribute as found in the given entity.booleanValidates the given value against the valid items for this attribute.Methods inherited from interface AttributeDefinition
attribute, caption, comparator, dateTimeFormatter, dateTimePattern, derived, description, entityType, format, formatted, fractionDigits, hidden, mnemonic, roundingMode
-
Field Details
-
TRIM_STRINGS
Specifies whether String values should be trimmed by default- Value type: Boolean
- Default value: true
- See Also:
-
-
Method Details
-
nullable
boolean nullable()- Returns:
- true if null is a valid value for this attribute
-
maximum
-
minimum
-
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
-
validItem
-
items
-
hasDefaultValue
boolean hasDefaultValue()- Returns:
- true if a default value has been set for this attribute
-
defaultValue
-
validate
Validates the value of this attribute as found in the given entity.Note: When validating non-nullable attributes during entity insertion (when the entity does not exist), null values are allowed for:
- Columns with default values - the database will provide the default value
- Generated columns, primary key or not - the
Column.Generatorwill provide the value
- Parameters:
entity- the entity containing the value to validatenullable- true if null values are allowed in this validation context, false if null should trigger a null validation exception- Throws:
AttributeValidationException- in case the value of this attribute is invalid in the given entity- See Also:
-