org.apache.tomcat.util.bcel.classfile

## Class Attribute

- java.lang.Object
- - org.apache.tomcat.util.bcel.classfile.Attribute

All Implemented Interfaces:
  Serializable, Cloneable

Direct Known Subclasses:
  AnnotationDefault, Annotations, Code, ConstantValue, Deprecated, EnclosingMethod, ExceptionTable, InnerClasses, LineNumberTable, LocalVariableTable, LocalVariableTypeTable, ParameterAnnotations, PMGClass, Signature, SourceFile, StackMap, StackMapTable, Synthetic, Unknown

    public abstract class Attribute
    extends Object
    implements Cloneable, 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.

Author:
  M. Dahm
See Also:
  `ConstantValue`, `SourceFile`, `Code`, `Unknown`, `ExceptionTable`, `LineNumberTable`, `LocalVariableTable`, `InnerClasses`, `Synthetic`, `Deprecated`, `Signature`, Serialized Form

### Field Summary

Fields
`protected ConstantPool` `constant_pool`
`protected int` `length`
`protected int` `name_index`
`protected byte` `tag`

### Constructor Summary

Constructors
`protected` `Attribute(byte tag, int name_index, int length, ConstantPool constant_pool)`

### Method Summary

Methods
`Attribute` `clone()` Use copy() if you want to have a deep copy(), i.e., with all references copied correctly.
`abstract Attribute` `copy(ConstantPool _constant_pool)`
`String` `getName()`
`byte` `getTag()`
`static Attribute` `readAttribute(DataInputStream file, ConstantPool constant_pool)`
`String` `toString()`

### 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

### Constructor Detail

#### Attribute

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

### Method Detail

#### readAttribute

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

Throws:
  `IOException`
  `ClassFormatException`

#### getName

    public String getName()

Returns:
  Name of attribute

#### getTag

    public final byte getTag()

Returns:
  Tag of attribute, i.e., its type. Value may not be altered, thus there is no setTag() method.

#### clone

    public Attribute clone()

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

Overrides:
  `clone` in class `Object`
Returns:
  shallow copy of this attribute

#### copy

    public abstract Attribute copy(ConstantPool _constant_pool)

Returns:
  deep copy of this attribute

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`
Returns:
  attribute name.