Class FieldGen

All Implemented Interfaces:
Cloneable, NamedAndTyped

public class FieldGen extends FieldGenOrMethodGen
Template class for building up a field. The only extraordinary thing one can do is to add a constant value attribute to a field (which must of course be compatible with to the declared type).
See Also:
  • Constructor Details

    • FieldGen

      public FieldGen(Field field, ConstantPoolGen cp)
      Instantiate from existing field.
      Parameters:
      field - Field object.
      cp - constant pool (must contain the same entries as the field's constant pool).
    • FieldGen

      public FieldGen(int accessFlags, Type type, String name, ConstantPoolGen cp)
      Declare a field. If it is static (isStatic() == true) and has a basic type like int or String it may have an initial value associated with it as defined by setInitValue().
      Parameters:
      accessFlags - access qualifiers
      type - field type
      name - field name
      cp - constant pool
  • Method Details