Interface Maker

All Known Subinterfaces:
ClassMaker, FieldMaker, MethodMaker

public interface Maker
Base interface for making classes, methods, and fields.
  • Method Details

    • name

      String name()
      Returns the name of the item being made.
    • public_

      Maker public_()
      Switch this item to be public.
      Returns:
      this
    • private_

      Maker private_()
      Switch this item to be private.
      Returns:
      this
    • protected_

      Maker protected_()
      Switch this item to be protected.
      Returns:
      this
    • static_

      Maker static_()
      Switch this item to be static.
      Returns:
      this
    • final_

      Maker final_()
      Switch this item to be final.
      Returns:
      this
    • synthetic

      Maker synthetic()
      Indicate that this item is synthetic.
      Returns:
      this
    • signature

      Maker 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.
      Returns:
      this
      Throws:
      IllegalArgumentException - if given an unsupported component
    • classMaker

      ClassMaker classMaker()
      Returns the ClassMaker for this item, which can also be used as a type specification.
    • addAnnotation

      AnnotationMaker addAnnotation(Object annotationType, boolean visible)
      Add an annotation to this item.
      Parameters:
      annotationType - name or class which refers to an annotation interface
      visible - true if annotation is visible at runtime
      Throws:
      IllegalArgumentException - if the annotation type is unsupported
    • addAttribute

      void addAttribute(String name, Object value)
      Add a generic JVM attribute which optionally references a constant value. This is an advanced feature for defining attributes which aren't directly supported by the core maker API. Allowed value types are: int, float, long, double, String, Class, raw byte[], or an array of values. Arrays aren't encoded with any length prefix, but a raw byte[] as the first element can be interpreted as such.