Interface FieldMaker

All Superinterfaces:
Maker

public interface FieldMaker extends Maker
Allows new fields to be defined within a class.
See Also:
  • Method Details

    • name

      String name()
      Returns the name of this field.
    • public_

      FieldMaker public_()
      Switch this field to be public. Fields are package-private by default.
      Specified by:
      public_ in interface Maker
      Returns:
      this
    • private_

      FieldMaker private_()
      Switch this field to be private. Fields are package-private by default.
      Specified by:
      private_ in interface Maker
      Returns:
      this
    • protected_

      FieldMaker protected_()
      Switch this field to be protected. Fields are package-private by default.
      Specified by:
      protected_ in interface Maker
      Returns:
      this
    • static_

      FieldMaker static_()
      Switch this field to be static. Fields are non-static by default.
      Specified by:
      static_ in interface Maker
      Returns:
      this
    • final_

      FieldMaker final_()
      Switch this field to be final. Fields are non-final by default.
      Specified by:
      final_ in interface Maker
      Returns:
      this
    • volatile_

      FieldMaker volatile_()
      Switch this field to be volatile. Fields are non-volatile by default.
      Returns:
      this
    • transient_

      FieldMaker transient_()
      Switch this field to be transient. Fields are non-transient by default.
      Returns:
      this
    • synthetic

      FieldMaker synthetic()
      Indicate that this field is synthetic. Fields are non-synthetic by default.
      Specified by:
      synthetic in interface Maker
      Returns:
      this
    • enum_

      FieldMaker enum_()
      Indicate that this field is an enum constant. No checks or modifications are performed to ensure that the enum field is defined correctly.
      Returns:
      this
    • signature

      FieldMaker signature(Object... components)
      Define a signature for this member, which is a string for supporting generic types. The components can be strings or types (class, ClassMaker, etc), which are concatenated into a single string. Consult the JVM specification for the signature syntax.
      Specified by:
      signature in interface Maker
      Returns:
      this
    • init

      FieldMaker init(Object value)
      Set an initial constant value for this field. The allowed constants are the same as those allowed by the Variable.set method. Complex constants can be assigned using a static initializer.
      Returns:
      this
      Throws:
      IllegalStateException - if not a static field
      IllegalArgumentException - if the value type is unsupported, or if it's not compatible with the field type