Package gnu.bytecode

Class Field

All Implemented Interfaces:
AttrContainer, Member

public class Field extends Location implements AttrContainer, Member
  • Constructor Details

    • Field

      public Field(ClassType ctype)
      Add a new Field to a ClassType.
  • Method Details

    • getAttributes

      public final Attribute getAttributes()
      Description copied from interface: AttrContainer
      Get the (first) Attribute of this container.
      Specified by:
      getAttributes in interface AttrContainer
    • setAttributes

      public final void setAttributes(Attribute attributes)
      Description copied from interface: AttrContainer
      Set the (list of) Attributes of this container.
      Specified by:
      setAttributes in interface AttrContainer
    • getDeclaringClass

      public final ClassType getDeclaringClass()
      Specified by:
      getDeclaringClass in interface Member
    • getConstants

      public final ConstantPool getConstants()
      Specified by:
      getConstants in interface AttrContainer
    • setStaticFlag

      public final void setStaticFlag(boolean is_static)
    • getStaticFlag

      public final boolean getStaticFlag()
      Specified by:
      getStaticFlag in interface Member
    • getFlags

      public final int getFlags()
    • getModifiers

      public final int getModifiers()
      Specified by:
      getModifiers in interface Member
    • setModifiers

      public final void setModifiers(int modifiers)
    • getType

      public Type getType()
      Overrides:
      getType in class Location
    • getReflectField

      public Field getReflectField() throws NoSuchFieldException
      Throws:
      NoSuchFieldException
    • getAnnotation

      public <T extends Annotation> T getAnnotation(Class<T> clas)
      Specified by:
      getAnnotation in interface Member
    • setSourceName

      public void setSourceName(String name)
    • getSourceName

      public String getSourceName()
    • searchField

      public static Field searchField(Field fields, String name)
      Find a field with the given name.
      Parameters:
      fields - list of fields to search
      name - (interned source) name of field to look for
    • getNext

      public final Field getNext()
    • setConstantValue

      public final void setConstantValue(Object value, ClassType ctype)
      Set the ConstantValue attribute for this field.
      Parameters:
      value - the value to use for the ConstantValue attribute of this field
      ctype - the class that contains this field This field's type is used to determine the kind of constant.
    • hasConstantValueAttr

      public boolean hasConstantValueAttr()
    • toString

      public String toString()
      Overrides:
      toString in class Object