Interface FieldMaker

All Superinterfaces:
Maker

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

    • type

      Type type()
      Returns the type of this field being made.
    • name

      String name()
      Returns the name of this field.
      Specified by:
      name in interface Maker
    • 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 initExact or a static initializer.
      Returns:
      this
      Throws:
      IllegalArgumentException - if the value isn't a supported constant
      IllegalStateException - if not a static field, or if the value type isn't compatible with the field type
    • initExact

      FieldMaker initExact(Object value)
      Set an exact initial constant value for this field, supported only when the class is built dynamically instead of loaded from a file. At runtime, the object instance provided here is exactly the same as referenced by the generated class. For simple constants, the regular init method is preferred.
      Returns:
      this
      Throws:
      IllegalStateException - if not a static field, or if the value isn't compatible with the field type, or if the class being made is external
      See Also: