Interface FieldCreator

All Superinterfaces:
AnnotatableCreator, GenericTyped, MemberCreator, ModifiableCreator, SimpleTyped, Typed
All Known Subinterfaces:
InstanceFieldCreator, StaticFieldCreator

public sealed interface FieldCreator extends MemberCreator, GenericTyped permits InstanceFieldCreator, StaticFieldCreator (not exhaustive)
A creator for a field.
  • Method Details

    • type

      ClassDesc type()
      Description copied from interface: MemberCreator
      Returns the type of this member (not null).
      Specified by:
      type in interface MemberCreator
      Specified by:
      type in interface SimpleTyped
      Specified by:
      type in interface Typed
      Returns:
      the type of this member (not null)
    • desc

      FieldDesc desc()
      Returns the field type descriptor.
      Specified by:
      desc in interface MemberCreator
      Returns:
      the field type descriptor
    • setType

      void setType(GenericType type)
      Change the type of the field to the given type.
      Parameters:
      type - the generic type (must not be null)
    • setType

      void setType(ClassDesc type)
      Change the type of the field to the given type.
      Parameters:
      type - the class type descriptor (must not be null)
    • setType

      default void setType(Class<?> type)
      Change the type of the field to the given type.
      Parameters:
      type - the class type (must not be null)
    • setInitial

      void setInitial(Const initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value (must not be null)
    • setInitial

      default void setInitial(int initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value
    • setInitial

      default void setInitial(long initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value
    • setInitial

      default void setInitial(float initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value
    • setInitial

      default void setInitial(double initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value
    • setInitial

      default void setInitial(String initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value
    • setInitial

      default void setInitial(Class<?> initial)
      Provide an initial constant value for this field.
      Parameters:
      initial - the initial value
    • setInitializer

      void setInitializer(Consumer<BlockCreator> init)
      Provide an initializer for this field which will be concatenated with the class or instance initializer(s).
      Parameters:
      init - the builder for the initializer which yields the field initial value (must not be null)
    • volatile_

      default void volatile_()
      Add the volatile modifier flag to this creator.