Class DynamicType.Builder.FieldDefinition.Optional.Valuable.AbstractBase.Adapter<V>

Type Parameters:
V - A loaded type that the built type is guaranteed to be a subclass of.
All Implemented Interfaces:
DynamicType.Builder<V>, DynamicType.Builder.FieldDefinition<V>, DynamicType.Builder.FieldDefinition.Optional<V>, DynamicType.Builder.FieldDefinition.Optional.Valuable<V>, DynamicType.Builder.FieldDefinition.Valuable<V>
Direct Known Subclasses:
DynamicType.Builder.AbstractBase.Adapter.FieldDefinitionAdapter, DynamicType.Builder.AbstractBase.Adapter.FieldMatchAdapter
Enclosing class:
DynamicType.Builder.FieldDefinition.Optional.Valuable.AbstractBase<U>

@Enhance private abstract static class DynamicType.Builder.FieldDefinition.Optional.Valuable.AbstractBase.Adapter<V> extends DynamicType.Builder.FieldDefinition.Optional.Valuable.AbstractBase<V>
An adapter for an optional field definition that allows for defining a value.
  • Field Details

  • Constructor Details

    • Adapter

      protected Adapter(FieldAttributeAppender.Factory fieldAttributeAppenderFactory, Transformer<FieldDescription> transformer, Object defaultValue)
      Creates a new field adapter.
      Parameters:
      fieldAttributeAppenderFactory - The field attribute appender factory to apply.
      transformer - The field transformer to apply.
      defaultValue - The field's default value or null if no value is to be defined.
  • Method Details

    • attribute

      public DynamicType.Builder.FieldDefinition.Optional<V> attribute(FieldAttributeAppender.Factory fieldAttributeAppenderFactory)
      Applies the supplied attribute appender factory onto the previously defined or matched field.
      Parameters:
      fieldAttributeAppenderFactory - The field attribute appender factory that should be applied on the previously defined or matched field.
      Returns:
      A new builder that is equal to this builder but with the supplied field attribute appender factory applied to the previously defined or matched field.
    • transform

      Applies the supplied transformer onto the previously defined or matched field. The transformed field is written as it is and it not subject to any validations.
      Parameters:
      transformer - The transformer to apply to the previously defined or matched field.
      Returns:
      A new builder that is equal to this builder but with the supplied field transformer applied to the previously defined or matched field.
    • defaultValue

      protected DynamicType.Builder.FieldDefinition.Optional<V> defaultValue(Object defaultValue)
      Defines the supplied value as a default value of the previously defined or matched field.
      Specified by:
      defaultValue in class DynamicType.Builder.FieldDefinition.Optional.Valuable.AbstractBase<V>
      Parameters:
      defaultValue - The value to define as a default value of the defined field.
      Returns:
      A new builder that is equal to this builder but with the given default value declared for the previously defined or matched field.
    • materialize

      protected abstract DynamicType.Builder.FieldDefinition.Optional<V> materialize(FieldAttributeAppender.Factory fieldAttributeAppenderFactory, Transformer<FieldDescription> transformer, Object defaultValue)
      Creates a new optional field definition for which all of the supplied values are represented.
      Parameters:
      fieldAttributeAppenderFactory - The field attribute appender factory to apply.
      transformer - The field transformer to apply.
      defaultValue - The field's default value or null if no value is to be defined.
      Returns:
      A new field definition that represents the supplied values.