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:
  • Field Details

    • DEFAULT_FRACTION_DIGITS

      static final int DEFAULT_FRACTION_DIGITS
      The default maximum fraction digits for floating point numbers
      See Also:
    • FRACTION_DIGITS

      static final PropertyValue<Integer> 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

      static final PropertyValue<RoundingMode> ROUNDING_MODE
      Specifies the default rounding mode used for decimal property values
      See Also:
    • NUMBER_GROUPING

      static final PropertyValue<Boolean> NUMBER_GROUPING
      Specifies whether number grouping is used by default
      • Value type: Boolean
      • Default value: false
    • GROUPING_SEPARATOR

      static final PropertyValue<Character> GROUPING_SEPARATOR
      Specifies the default number grouping separator
      • Value type: Character
      • Default value: The grouping separator for the default locale
    • DECIMAL_SEPARATOR

      static final PropertyValue<Character> DECIMAL_SEPARATOR
      Specifies the default number decimal separator.
      • Value type: Character
      • Default value: The decimal separator for the default locale
    • USE_LEXICAL_STRING_COMPARATOR

      static final PropertyValue<Boolean> USE_LEXICAL_STRING_COMPARATOR
      Specifies whether String values should use a lexical comparator by default
      • Value type: Boolean
      • Default value: true
    • TRIM_STRINGS

      static final PropertyValue<Boolean> TRIM_STRINGS
      Specifies whether String values should be trimmed by default
      • Value type: Boolean
      • Default value: true
      See Also:
  • Method Details

    • maximum

      Optional<Number> maximum()
      Returns:
      the maximum allowed value for this attribute, an empty Optional if none is defined, only applicable to numerical attributes
    • minimum

      Optional<Number> 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

      Optional<Format> 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

      Optional<String> 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

      boolean validItem(@Nullable T value)
      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

      List<Item<T>> 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