public abstract class Attribute extends Object implements Cloneable, Node, Serializable
ConstantValue
,
SourceFile
,
Code
,
Unknown
,
ExceptionTable
,
LineNumberTable
,
LocalVariableTable
,
InnerClasses
,
Synthetic
,
Deprecated
,
Signature
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected ConstantPool |
constant_pool |
protected int |
length |
protected int |
name_index |
protected byte |
tag |
Modifier | Constructor and Description |
---|---|
protected |
Attribute(byte tag,
int name_index,
int length,
ConstantPool constant_pool) |
Modifier and Type | Method and Description |
---|---|
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(String name,
AttributeReader r)
Add an Attribute reader capable of parsing (user-defined) attributes
named "name".
|
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(DataOutputStream file)
Dump attribute to file stream in binary format.
|
ConstantPool |
getConstantPool() |
int |
getLength() |
String |
getName() |
int |
getNameIndex() |
byte |
getTag() |
static Attribute |
readAttribute(DataInputStream file,
ConstantPool constant_pool) |
static void |
removeAttributeReader(String name)
Remove attribute reader
|
void |
setConstantPool(ConstantPool constant_pool) |
void |
setLength(int length) |
void |
setNameIndex(int name_index) |
String |
toString() |
protected int name_index
protected int length
protected byte tag
protected ConstantPool constant_pool
protected Attribute(byte tag, int name_index, int length, ConstantPool constant_pool)
public abstract void accept(Visitor v)
public void dump(DataOutputStream file) throws IOException
file
- Output file streamIOException
public static void addAttributeReader(String name, AttributeReader r)
name
- the name of the attribute as stored in the class filer
- the reader objectpublic static void removeAttributeReader(String name)
name
- the name of the attribute as stored in the class filepublic static Attribute readAttribute(DataInputStream file, ConstantPool constant_pool) throws IOException, ClassFormatException
IOException
ClassFormatException
public String getName()
public final int getLength()
public final void setLength(int length)
length
- length in bytes.public final void setNameIndex(int name_index)
name_index
- of attribute.public final int getNameIndex()
public final byte getTag()
public final ConstantPool getConstantPool()
ConstantPool
public final void setConstantPool(ConstantPool constant_pool)
constant_pool
- Constant pool to be used for this object.ConstantPool
public Object clone()
public abstract Attribute copy(ConstantPool _constant_pool)