Package javassist.bytecode
Class AnnotationDefaultAttribute
java.lang.Object
javassist.bytecode.AttributeInfo
javassist.bytecode.AnnotationDefaultAttribute
A class representing 
AnnotationDefault_attribute.
 For example, if you declare the following annotation type:
 @interface Author {
   String name() default "Shakespeare";
   int age() default 99;
 }
 
 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:
 
 
 ClassPool pool = ...
 CtClass cc = pool.get("Author");
 CtMethod cm = cc.getDeclaredMethod("age");
 MethodInfo minfo = cm.getMethodInfo();
 AnnotationDefaultAttribute ada
         = (AnnotationDefaultAttribute)
           minfo.getAttribute(AnnotationDefaultAttribute.tag);
 MemberValue value = ada.getDefaultValue());    // default value of age
 
 If the following statement is executed after the code above, the default value of age is set to 80:
ada.setDefaultValue(new IntegerMemberValue(minfo.getConstPool(), 80));
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs an emptyAnnotationDefault_attribute.AnnotationDefaultAttribute(ConstPool cp, byte[] info) Constructs anAnnotationDefault_attribute.
- 
Method SummaryModifier and TypeMethodDescriptionCopies this attribute and returns a new copy.Obtains the default value represented by this attribute.voidsetDefaultValue(MemberValue value) Changes the default value represented by this attribute.toString()Returns a string representation of this object.Methods inherited from class javassist.bytecode.AttributeInfoget, getConstPool, getName, length, set
- 
Field Details- 
tagThe name of theAnnotationDefaultattribute.- See Also:
 
 
- 
- 
Constructor Details- 
AnnotationDefaultAttributeConstructs anAnnotationDefault_attribute.- Parameters:
- cp- constant pool
- info- the contents of this attribute. It does not include- attribute_name_indexor- attribute_length.
 
- 
AnnotationDefaultAttributeConstructs an emptyAnnotationDefault_attribute. The default value can be set bysetDefaultValue().- Parameters:
- cp- constant pool
- See Also:
 
 
- 
- 
Method Details- 
copyCopies this attribute and returns a new copy.- Overrides:
- copyin class- AttributeInfo
- Parameters:
- newCp- the constant pool table used by the new copy.
- classnames- pairs of replaced and substituted class names.
 
- 
getDefaultValueObtains the default value represented by this attribute.
- 
setDefaultValueChanges the default value represented by this attribute.- Parameters:
- value- the new value.
- See Also:
 
- 
toStringReturns a string representation of this object.
 
-