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 ValueAttributeDefinition.Builder<T,B>, ForeignKeyDefinition.Builder (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
    • defaultValue

      B defaultValue(T defaultValue)
      Sets the default value for this attribute, overrides the underlying column default value, if any
      Parameters:
      defaultValue - the value to use as default
      Returns:
      this builder instance
    • defaultValue

      B defaultValue(AttributeDefinition.ValueSupplier<T> supplier)
      Sets the default value supplier, use in case of dynamic default values.
      Parameters:
      supplier - the default value supplier
      Returns:
      this builder instance
    • 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
    • nullable

      B nullable(boolean nullable)
      Specifies whether this attribute is nullable. Note that this will not prevent the value from being set to null, only prevent successful validation of the entity.
      Parameters:
      nullable - specifies whether null is a valid value for this attribute
      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