Attributepublic class Attribute extends Object A non standard class, field, method or code attribute. |
Fields Summary |
---|
public final String | typeThe type of this attribute. | public Attribute | nextThe next attribute in this attribute list. May be null. |
Constructors Summary |
---|
protected Attribute(String type)Constructs a new empty attribute.
this.type = type;
|
Methods Summary |
---|
final int | getCount()Returns the length of the attribute list that begins with this attribute.
int count = 0;
Attribute attr = this;
while (attr != null) {
if (!attr.isUnknown()) {
count += 1;
}
attr = attr.next;
}
return count;
| protected oracle.toplink.libraries.asm.Label[] | getLabels()Returns the labels corresponding to this attribute.
return null;
| final int | getSize(oracle.toplink.libraries.asm.ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals)Returns the size of all the attributes in this attribute list.
Attribute attr = this;
int size = 0;
while (attr != null) {
if (!attr.isUnknown()) {
cw.newUTF8(attr.type);
size += attr.write(cw, code, len, maxStack, maxLocals).length + 6;
}
attr = attr.next;
}
return size;
| public boolean | isUnknown()Returns true if this type of attribute is unknown.
return getClass().getName().equals("oracle.toplink.libraries.asm.Attribute");
| final void | put(oracle.toplink.libraries.asm.ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals, oracle.toplink.libraries.asm.ByteVector out)Writes all the attributes of this attribute list in the given byte vector.
if (next != null) {
next.put(cw, code, len, maxStack, maxLocals, out);
}
if (isUnknown()) {
if (cw.checkAttributes) {
throw new IllegalArgumentException("Unknown attribute type " + type);
}
} else {
ByteVector b = write(cw, code, len, maxStack, maxLocals);
out.putShort(cw.newUTF8(type)).putInt(b.length);
out.putByteArray(b.data, 0, b.length);
}
| protected oracle.toplink.libraries.asm.Attribute | read(oracle.toplink.libraries.asm.ClassReader cr, int off, int len, char[] buf, int codeOff, oracle.toplink.libraries.asm.Label[] labels)Reads a {@link #type type} attribute. This method must return a new
{@link Attribute} object, of type {@link #type type}, corresponding to the
len bytes starting at the given offset, in the given class reader.
return new Attribute(type);
| protected oracle.toplink.libraries.asm.ByteVector | write(oracle.toplink.libraries.asm.ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals)Returns the byte array form of this attribute.
return new ByteVector();
|
|