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

Type Parameters:
T - the value type
B - the builder type
All Known Subinterfaces:
ColumnDefinition.Builder<T,B>, DerivedAttributeDefinition.DenormalizedBuilder<T,B>, DerivedAttributeDefinition.DerivedBuilder<T,B>, ForeignKeyDefinition.Builder, TransientAttributeDefinition.Builder<T,B>, ValueAttributeDefinition.Builder<T,B>
Enclosing interface:
AttributeDefinition<T>

public static sealed interface AttributeDefinition.Builder<T,B extends AttributeDefinition.Builder<T,B>> permits DerivedAttributeDefinition.DenormalizedBuilder<T,B>, DerivedAttributeDefinition.DerivedBuilder<T,B>, ForeignKeyDefinition.Builder, ValueAttributeDefinition.Builder<T,B> (not exhaustive)
Builds a attribute definition instance
  • Method Details

    • attribute

      Attribute<T> attribute()
      Returns:
      the underying attribute
    • caption

      B caption(String caption)
      Note that this method has a side effect, when setting the caption to a null value this attribute is automatically hidden via hidden(boolean), when a non-null value is used it is automatically made visible (as in, not hidden).
      Parameters:
      caption - the caption
      Returns:
      this builder instance
      See Also:
    • captionResource

      B captionResource(String captionResourceKey)
      Specifies the key to use when retrieving the caption for this attribute from the entity resource bundle, in case it differs from the attribute name (Attribute.name()), which is the default value. Note that this configures the attribute to not be hidden.
      Parameters:
      captionResourceKey - the caption resource bundle key
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case the caption has already been set
      IllegalStateException - in case no resource bundle is specified for the entity
      IllegalStateException - in case the caption resource is not found in the entity resource bundle
      See Also:
    • captionResource

      B captionResource(String resourceBundleName, String captionResourceKey)
      Specifies the key to use when retrieving the caption for this attribute from the given resource bundle. Note that this configures the attribute to not be hidden.
      Parameters:
      resourceBundleName - the resource bundle name
      captionResourceKey - the caption resource bundle key
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case the caption has already been set
      IllegalStateException - in case the caption resource is not found in the given resource bundle
    • mnemonicResource

      B mnemonicResource(String mnemonicResourceKey)
      Specifies the key to use when retrieving the mnemonic for this attribute from the entity resource bundle, in case it differs from Attribute.name() + AttributeDefinition.MNEMONIC_RESOURCE_SUFFIX, which is the default value.
      Parameters:
      mnemonicResourceKey - the mnemonic resource bundle key
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case the mnemonic has already been set
      IllegalStateException - in case no resource bundle is specified for the entity
      IllegalStateException - in case the mnemonic resource is not found in the entity resource bundle
      See Also:
    • mnemonicResource

      B mnemonicResource(String resourceBundleName, String mnemonicResourceKey)
      Specifies the key to use when retrieving the mnemonic for this attribute from the given resource bundle.
      Parameters:
      resourceBundleName - the resource bundle name
      mnemonicResourceKey - the mnemonic resource bundle key
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case the mnemonic has already been set
      IllegalStateException - in case the mnemonic resource is not found in the given resource bundle
    • 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 AttributeDefinition.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
    • hidden

      B hidden(boolean hidden)
      Specifies whether this attribute should be hidden in table views
      Parameters:
      hidden - true if this attribute should be hidden
      Returns:
      this builder instance
    • mnemonic

      B mnemonic(char mnemonic)
      Sets the mnemonic to use when creating a label for this attribute
      Parameters:
      mnemonic - the mnemonic character
      Returns:
      this builder instance
    • description

      B description(String description)
      Sets the description for this attribute, used for tooltips f.ex.
      Parameters:
      description - a String describing this attribute
      Returns:
      this builder instance
    • descriptionResource

      B descriptionResource(String descriptionResourceKey)
      Specifies the key to use when retrieving the description for this attribute from the entity resource bundle, in case it differs from Attribute.name() + AttributeDefinition.DESCRIPTION_RESOURCE_SUFFIX, which is the default value.
      Parameters:
      descriptionResourceKey - the description resource bundle key
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case the description has already been set
      IllegalStateException - in case no resource bundle is specified for the entity
      IllegalStateException - in case the description resource is not found in the entity resource bundle
      See Also:
    • descriptionResource

      B descriptionResource(String resourceBundleName, String descriptionResourceKey)
      Specifies the key to use when retrieving the description for this attribute from the entity resource bundle, in case it differs from Attribute.name() + AttributeDefinition.DESCRIPTION_RESOURCE_SUFFIX, which is the default value.
      Parameters:
      resourceBundleName - the resource bundle name
      descriptionResourceKey - the description resource bundle key
      Returns:
      this builder instance
      Throws:
      IllegalStateException - in case the description has already been set
      IllegalStateException - in case the description resource is not found in the given resource bundle
    • comparator

      B comparator(Comparator<T> comparator)
      Parameters:
      comparator - the Comparator to use when comparing values for this attribute
      Returns:
      this builder instance
    • build

      Builds a new attribute definition instance
      Returns:
      a new attribute definition instance based on this builder