Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.bcel.classfile
Class Attribute  view Attribute download Attribute.java

java.lang.Object
  extended byorg.apache.bcel.classfile.Attribute
All Implemented Interfaces:
java.lang.Cloneable, Node, java.io.Serializable
Direct Known Subclasses:
Code, ConstantValue, Deprecated, ExceptionTable, InnerClasses, LineNumberTable, LocalVariableTable, PMGClass, Signature, SourceFile, StackMap, Synthetic, Unknown

public abstract class Attribute
extends java.lang.Object
implements java.lang.Cloneable, Node, java.io.Serializable

Abstract super class for Attribute objects. Currently the ConstantValue, SourceFile, Code, Exceptiontable, LineNumberTable, LocalVariableTable, InnerClasses and Synthetic attributes are supported. The Unknown attribute stands for non-standard-attributes.

Version:
$Id: Attribute.java 386056 2006-03-15 11:31:56Z tcurdt $

Field Summary
protected  ConstantPool constant_pool
           
protected  int length
           
protected  int name_index
           
private static java.util.Map readers
           
protected  byte tag
           
 
Constructor Summary
protected Attribute(byte tag, int name_index, int length, ConstantPool constant_pool)
           
 
Method Summary
abstract  void accept(Visitor v)
          Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
static void addAttributeReader(java.lang.String name, AttributeReader r)
          Add an Attribute reader capable of parsing (user-defined) attributes named "name".
 java.lang.Object clone()
          Use copy() if you want to have a deep copy(), i.e., with all references copied correctly.
abstract  Attribute copy(ConstantPool _constant_pool)
           
 void dump(java.io.DataOutputStream file)
          Dump attribute to file stream in binary format.
 ConstantPool getConstantPool()
           
 int getLength()
           
 int getNameIndex()
           
 byte getTag()
           
static Attribute readAttribute(java.io.DataInputStream file, ConstantPool constant_pool)
           
static void removeAttributeReader(java.lang.String name)
          Remove attribute reader
 void setConstantPool(ConstantPool constant_pool)
           
 void setLength(int length)
           
 void setNameIndex(int name_index)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name_index

protected int name_index

length

protected int length

tag

protected byte tag

constant_pool

protected ConstantPool constant_pool

readers

private static java.util.Map readers
Constructor Detail

Attribute

protected Attribute(byte tag,
                    int name_index,
                    int length,
                    ConstantPool constant_pool)
Method Detail

accept

public abstract void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Specified by:
accept in interface Node

dump

public void dump(java.io.DataOutputStream file)
          throws java.io.IOException
Dump attribute to file stream in binary format.


addAttributeReader

public static void addAttributeReader(java.lang.String name,
                                      AttributeReader r)
Add an Attribute reader capable of parsing (user-defined) attributes named "name". You should not add readers for the standard attributes such as "LineNumberTable", because those are handled internally.


removeAttributeReader

public static void removeAttributeReader(java.lang.String name)
Remove attribute reader


readAttribute

public static final Attribute readAttribute(java.io.DataInputStream file,
                                            ConstantPool constant_pool)
                                     throws java.io.IOException,
                                            ClassFormatException

getLength

public final int getLength()

setLength

public final void setLength(int length)

setNameIndex

public final void setNameIndex(int name_index)

getNameIndex

public final int getNameIndex()

getTag

public final byte getTag()

getConstantPool

public final ConstantPool getConstantPool()

setConstantPool

public final void setConstantPool(ConstantPool constant_pool)

clone

public java.lang.Object clone()
Use copy() if you want to have a deep copy(), i.e., with all references copied correctly.


copy

public abstract Attribute copy(ConstantPool _constant_pool)

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).