javassist.bytecode

Class AnnotationDefaultAttribute

public class AnnotationDefaultAttribute extends AttributeInfo

A class representing AnnotationDefault_attribute.

For example, if you declare the following annotation type:

The defautl values of name and age are stored as annotation default attributes in Author.class. The following code snippet obtains the default value of name:

If the following statement is executed after the code above, the default value of age is set to 80:

See Also: AnnotationsAttribute MemberValue

Field Summary
static Stringtag
The name of the AnnotationDefault attribute.
Constructor Summary
AnnotationDefaultAttribute(ConstPool cp, byte[] info)
Constructs an AnnotationDefault_attribute.
AnnotationDefaultAttribute(ConstPool cp)
Constructs an empty AnnotationDefault_attribute.
Method Summary
AttributeInfocopy(ConstPool newCp, Map classnames)
Copies this attribute and returns a new copy.
MemberValuegetDefaultValue()
Obtains the default value represented by this attribute.
voidsetDefaultValue(MemberValue value)
Changes the default value represented by this attribute.
StringtoString()
Returns a string representation of this object.

Field Detail

tag

public static final String tag
The name of the AnnotationDefault attribute.

Constructor Detail

AnnotationDefaultAttribute

public AnnotationDefaultAttribute(ConstPool cp, byte[] info)
Constructs an AnnotationDefault_attribute.

Parameters: cp constant pool info the contents of this attribute. It does not include attribute_name_index or attribute_length.

AnnotationDefaultAttribute

public AnnotationDefaultAttribute(ConstPool cp)
Constructs an empty AnnotationDefault_attribute. The default value can be set by setDefaultValue().

Parameters: cp constant pool

See Also: setDefaultValue

Method Detail

copy

public AttributeInfo copy(ConstPool newCp, Map classnames)
Copies this attribute and returns a new copy.

getDefaultValue

public MemberValue getDefaultValue()
Obtains the default value represented by this attribute.

setDefaultValue

public void setDefaultValue(MemberValue value)
Changes the default value represented by this attribute.

Parameters: value the new value.

See Also: Annotation

toString

public String toString()
Returns a string representation of this object.
Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.