org.objectweb.asm.attrs

Class AnnotationDefaultAttribute

Known Direct Subclasses:
ASMAnnotationDefaultAttribute

public class AnnotationDefaultAttribute
extends Attribute

The AnnotationDefault attribute is a variable length attribute in the attributes table of certain method_info structures, namely those representing elements of annotation types. The AnnotationDefault attribute records the default value for the element represented by the method_info structure. Each method_info structures representing an element of an annotation types may contain at most one AnnotationDefault attribute. The JVM must make this default value available so it can be applied by appropriate reflective APIs.

The AnnotationDefault attribute has the following format:

    AnnotationDefault_attribute {
      u2 attribute_name_index;
      u4 attribute_length;
      element_value default_value;
    }
 
The items of the AnnotationDefault structure are as follows:
element
Author:
Eugene Kuleshov
See Also:
JSR 175 : A Metadata Facility for the Java Programming Language

Field Summary

Object
defaultValue
Default value for annotation.

Fields inherited from class org.objectweb.asm.Attribute

next, type

Constructor Summary

AnnotationDefaultAttribute()
AnnotationDefaultAttribute(Object defaultValue)

Method Summary

protected Attribute
read(ClassReader cr, int off, int len, char[] buf, int codeOff, Label[] labels)
String
toString()
Returns value in the format described in JSR-175 for Java source code.
protected ByteVector
write(ClassWriter cw, byte[] code, int len, int maxStack, int maxLocals)

Methods inherited from class org.objectweb.asm.Attribute

getLabels, isUnknown, read, write

Field Details

defaultValue

public Object defaultValue
Default value for annotation. Could be one of Byte, Character, Double, Float, Integer, Long, Short, Boolean, String, Annotation.EnumConstValue, Type, Annotation or Object[].

Constructor Details

AnnotationDefaultAttribute

public AnnotationDefaultAttribute()

AnnotationDefaultAttribute

public AnnotationDefaultAttribute(Object defaultValue)

Method Details

read

protected Attribute read(ClassReader cr,
                         int off,
                         int len,
                         char[] buf,
                         int codeOff,
                         Label[] labels)
Overrides:
read in interface Attribute

toString

public String toString()
Returns value in the format described in JSR-175 for Java source code.
Returns:
value in the format described in JSR-175 for Java source code.

write

protected ByteVector write(ClassWriter cw,
                           byte[] code,
                           int len,
                           int maxStack,
                           int maxLocals)
Overrides:
write in interface Attribute