Interface ValueAttributeDefinition.Builder<T,B extends ValueAttributeDefinition.Builder<T,B>>

Type Parameters:
T - the value type
B - 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 Details

    • minimum

      B minimum(Number 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

      B maximum(Number 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

      B range(Number minimum, Number maximum)
      Only applicable to numerical attributes
      Parameters:
      minimum - the minimum allowed value for this attribute
      maximum - the maximum allowed value for this attribute
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case this is not a numerical attribute
    • maximumLength

      B maximumLength(int 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

      B fractionDigits(int 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 to format(Format). Note that values associated with this attribute are automatically rounded to ValueAttributeDefinition.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

      B roundingMode(RoundingMode 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

      B numberGrouping(boolean 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 to format(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

      B format(Format 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 null
      IllegalArgumentException - in case this is a numerical attribute and the given format is not a NumberFormat.
      IllegalStateException - if the underlying attribute is temporal, in which case dateTimePattern(String) or dateTimePattern(LocaleDateTimePattern) should be used.
    • dateTimePattern

      B dateTimePattern(String 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 invalid
      IllegalStateException - in case this is not a temporal attribute
      IllegalStateException - in case dateTimePattern(LocaleDateTimePattern) has been set
    • dateTimePattern

      B dateTimePattern(LocaleDateTimePattern 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 attribute
      IllegalStateException - in case dateTimePattern(String) has been set
    • trim

      B trim(boolean 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

      B items(List<Item<T>> items)
      Note that by default items are sorted by to their caption, not their value. Use AttributeDefinition.Builder.comparator(java.util.Comparator) to set a custom comparator.
      Parameters:
      items - the Items representing all the valid values for this attribute
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - in case the valid item list contains duplicate values
    • build

      Description copied from interface: AttributeDefinition.Builder
      Builds a new attribute definition instance
      Specified by:
      build in interface AttributeDefinition.Builder<T,B extends ValueAttributeDefinition.Builder<T,B>>
      Returns:
      a new attribute definition instance based on this builder