Class FieldGenOrMethodGen

java.lang.Object
org.apache.bcel.classfile.AccessFlags
org.apache.bcel.generic.FieldGenOrMethodGen
All Implemented Interfaces:
Cloneable, NamedAndTyped
Direct Known Subclasses:
FieldGen, MethodGen

public abstract class FieldGenOrMethodGen extends AccessFlags implements NamedAndTyped, Cloneable
Super class for FieldGen and MethodGen objects, since they have some methods in common!
  • Field Details

    • name

      @Deprecated protected String name
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • type

      @Deprecated protected Type type
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • cp

      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • attributeList

      private final List<Attribute> attributeList
    • annotationList

      private final List<AnnotationEntryGen> annotationList
  • Constructor Details

    • FieldGenOrMethodGen

      protected FieldGenOrMethodGen()
    • FieldGenOrMethodGen

      protected FieldGenOrMethodGen(int accessFlags)
      Since:
      6.0
  • Method Details

    • addAll

      protected void addAll(Attribute[] attrs)
    • addAnnotationEntry

      public void addAnnotationEntry(AnnotationEntryGen ag)
      Since:
      6.0
    • addAttribute

      public void addAttribute(Attribute a)
      Add an attribute to this method. Currently, the JVM knows about the 'Code', 'ConstantValue', 'Synthetic' and 'Exceptions' attributes. Other attributes will be ignored by the JVM but do no harm.
      Parameters:
      a - attribute to be added
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • getAnnotationEntries

      public AnnotationEntryGen[] getAnnotationEntries()
    • getAttributes

      public Attribute[] getAttributes()
      Returns:
      all attributes of this method.
    • getConstantPool

      public ConstantPoolGen getConstantPool()
    • getName

      public String getName()
      Specified by:
      getName in interface NamedAndTyped
      Returns:
      name of method/field.
    • getSignature

      public abstract String getSignature()
      Returns:
      signature of method/field.
    • getType

      public Type getType()
      Specified by:
      getType in interface NamedAndTyped
    • removeAnnotationEntries

      public void removeAnnotationEntries()
      Since:
      6.0
    • removeAnnotationEntry

      public void removeAnnotationEntry(AnnotationEntryGen ag)
      Since:
      6.0
    • removeAttribute

      public void removeAttribute(Attribute a)
      Remove an attribute.
    • removeAttributes

      public void removeAttributes()
      Remove all attributes.
    • setConstantPool

      public void setConstantPool(ConstantPoolGen cp)
    • setName

      public void setName(String name)
      Specified by:
      setName in interface NamedAndTyped
    • setType

      public void setType(Type type)
      Specified by:
      setType in interface NamedAndTyped