Class FieldOrMethod

java.lang.Object
org.apache.bcel.classfile.AccessFlags
org.apache.bcel.classfile.FieldOrMethod
All Implemented Interfaces:
Cloneable, Node
Direct Known Subclasses:
Field, Method

public abstract class FieldOrMethod extends AccessFlags implements Cloneable, Node
Abstract super class for fields and methods.
  • Field Details

    • name_index

      @Deprecated protected int name_index
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • signature_index

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

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

      Deprecated.
      (since 6.0) will be removed (not needed)
    • constant_pool

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

  • Method Details

    • copy_

      protected FieldOrMethod copy_(ConstantPool constantPool)
      Returns:
      deep copy of this field
    • dump

      public final void dump(DataOutputStream file) throws IOException
      Dump object to file stream on binary format.
      Parameters:
      file - Output file stream
      Throws:
      IOException - if an I/O error occurs.
    • getAnnotationEntries

      Returns:
      Annotations on the field or method
      Since:
      6.0
    • getAttributes

      public final Attribute[] getAttributes()
      Returns:
      Collection of object attributes.
    • getConstantPool

      public final ConstantPool getConstantPool()
      Returns:
      Constant pool used by this object.
    • getGenericSignature

      public final String getGenericSignature()
      Hunts for a signature attribute on the member and returns its contents. So where the 'regular' signature may be (Ljava/util/Vector;)V the signature attribute may in fact say 'Ljava/lang/Vector<Ljava/lang/String>;' Coded for performance - searches for the attribute only when requested - only searches for it once.
      Since:
      6.0
    • getName

      public final String getName()
      Returns:
      Name of object, i.e., method name or field name
    • getNameIndex

      public final int getNameIndex()
      Returns:
      Index in constant pool of object's name.
    • getSignature

      public final String getSignature()
      Returns:
      String representation of object's type signature (Java style)
    • getSignatureIndex

      public final int getSignatureIndex()
      Returns:
      Index in constant pool of field signature.
    • setAttributes

      public final void setAttributes(Attribute[] attributes)
      Parameters:
      attributes - Collection of object attributes.
    • setConstantPool

      public final void setConstantPool(ConstantPool constantPool)
      Parameters:
      constantPool - Constant pool to be used for this object.
    • setNameIndex

      public final void setNameIndex(int nameIndex)
      Parameters:
      nameIndex - Index in constant pool of object's name.
    • setSignatureIndex

      public final void setSignatureIndex(int signatureIndex)
      Parameters:
      signatureIndex - Index in constant pool of field signature.