|
Javassist 3.15.0-GA-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavassist.bytecode.annotation.Annotation
public class Annotation
The annotation
structure.
An instance of this class is returned by
getAnnotations()
in AnnotationsAttribute
or in ParameterAnnotationsAttribute
.
AnnotationsAttribute.getAnnotations()
,
ParameterAnnotationsAttribute.getAnnotations()
,
MemberValue
,
MemberValueVisitor
,
AnnotationsWriter
Constructor Summary | |
---|---|
Annotation(ConstPool cp,
CtClass clazz)
Constructs an annotation that can be accessed through the interface represented by clazz . |
|
Annotation(int type,
ConstPool cp)
Constructs an annotation including no members. |
|
Annotation(String typeName,
ConstPool cp)
Constructs an annotation including no members. |
Method Summary | |
---|---|
void |
addMemberValue(int nameIndex,
MemberValue value)
Adds a new member. |
void |
addMemberValue(String name,
MemberValue value)
Adds a new member. |
static MemberValue |
createMemberValue(ConstPool cp,
CtClass type)
Makes an instance of MemberValue . |
boolean |
equals(Object obj)
Returns true if the given object represents the same annotation as this object. |
Set |
getMemberNames()
Obtains all the member names. |
MemberValue |
getMemberValue(String name)
Obtains the member value with the given name. |
String |
getTypeName()
Obtains the name of the annotation type. |
Object |
toAnnotationType(ClassLoader cl,
ClassPool cp)
Constructs an annotation-type object representing this annotation. |
String |
toString()
Returns a string representation of the annotation. |
void |
write(AnnotationsWriter writer)
Writes this annotation. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Annotation(int type, ConstPool cp)
addMemberValue()
.
type
- the index into the constant pool table.
the entry at that index must be the
CONSTANT_Utf8_Info
structure
repreenting the name of the annotation interface type.cp
- the constant pool table.addMemberValue(String, MemberValue)
public Annotation(String typeName, ConstPool cp)
addMemberValue()
.
typeName
- the name of the annotation interface type.cp
- the constant pool table.addMemberValue(String, MemberValue)
public Annotation(ConstPool cp, CtClass clazz) throws NotFoundException
clazz
. The values of the members are
not specified.
cp
- the constant pool table.clazz
- the interface.
NotFoundException
- when the clazz is not foundMethod Detail |
---|
public static MemberValue createMemberValue(ConstPool cp, CtClass type) throws NotFoundException
MemberValue
.
cp
- the constant pool table.type
- the type of the member.
NotFoundException
- when the type is not foundpublic void addMemberValue(int nameIndex, MemberValue value)
nameIndex
- the index into the constant pool table.
The entry at that index must be
a CONSTANT_Utf8_info
structure.
structure representing the member name.value
- the member value.public void addMemberValue(String name, MemberValue value)
name
- the member name.value
- the member value.public String toString()
toString
in class Object
public String getTypeName()
public Set getMemberNames()
public MemberValue getMemberValue(String name)
If this annotation does not have a value for the
specified member,
this method returns null. It does not return a
MemberValue
with the default value.
The default value can be obtained from the annotation type.
name
- the member name
AnnotationDefaultAttribute
public Object toAnnotationType(ClassLoader cl, ClassPool cp) throws ClassNotFoundException, NoSuchClassError
@Author
,
this method returns an Author
object.
cl
- class loader for loading an annotation type.cp
- class pool for obtaining class files.
ClassNotFoundException
- if the class cannot found.
NoSuchClassError
- if the class linkage fails.public void write(AnnotationsWriter writer) throws IOException
writer
- the output.
IOException
- for an error during the writepublic boolean equals(Object obj)
equals
in class Object
|
Javassist 3.15.0-GA-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |