CtMember.Cache
Modifier and Type | Field and Description |
---|---|
private CtMember |
consTail |
private CtMember |
fieldTail |
private CtMember |
methodTail |
declaringClass, next
Constructor and Description |
---|
Cache(CtClassType decl) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addConstructor(CtMember cons) |
(package private) void |
addField(CtMember field) |
(package private) void |
addMethod(CtMember method) |
(package private) CtMember |
consHead() |
(package private) static int |
count(CtMember head,
CtMember tail) |
protected void |
extendToString(java.lang.StringBuffer buffer)
Invoked by
CtMember.toString() to add to the buffer and provide the
complete value. |
(package private) CtMember |
fieldHead() |
java.lang.Object |
getAnnotation(java.lang.Class clz)
Returns the annotation if the class has the specified annotation class.
|
java.lang.Object[] |
getAnnotations()
Returns the annotations associated with this member.
|
byte[] |
getAttribute(java.lang.String name)
Obtains a user-defined attribute with the given name.
|
java.lang.Object[] |
getAvailableAnnotations()
Returns the annotations associated with this member.
|
java.lang.String |
getGenericSignature()
Returns the generic signature of the member.
|
int |
getModifiers()
Obtains the modifiers of the member.
|
java.lang.String |
getName()
Obtains the name of the member.
|
java.lang.String |
getSignature()
Returns the character string representing the signature of the member.
|
boolean |
hasAnnotation(java.lang.Class clz)
Returns true if the class has the specified annotation class.
|
(package private) CtMember |
lastCons() |
(package private) CtMember |
lastField() |
(package private) CtMember |
lastMethod() |
(package private) CtMember |
methodHead() |
(package private) void |
remove(CtMember mem) |
void |
setAttribute(java.lang.String name,
byte[] data)
Adds a user-defined attribute.
|
void |
setGenericSignature(java.lang.String sig)
Sets the generic signature of the member.
|
void |
setModifiers(int mod)
Sets the encoded modifiers of the member.
|
getDeclaringClass, nameReplaced, next, toString, visibleFrom
private CtMember methodTail
private CtMember consTail
private CtMember fieldTail
Cache(CtClassType decl)
protected void extendToString(java.lang.StringBuffer buffer)
CtMember
CtMember.toString()
to add to the buffer and provide the
complete value. Subclasses should invoke this method, adding a
space before each token. The modifiers for the member are
provided first; subclasses should provide additional data such
as return type, field or method name, etc.extendToString
in class CtMember
public boolean hasAnnotation(java.lang.Class clz)
CtMember
hasAnnotation
in class CtMember
clz
- the annotation class.true
if the annotation is found, otherwise false
.public java.lang.Object getAnnotation(java.lang.Class clz) throws java.lang.ClassNotFoundException
CtMember
@Author
is associated
with this member, an Author
object is returned.
The member values can be obtained by calling methods on
the Author
object.getAnnotation
in class CtMember
clz
- the annotation class.null
.java.lang.ClassNotFoundException
public java.lang.Object[] getAnnotations() throws java.lang.ClassNotFoundException
CtMember
@Author
is associated
with this member, the returned array contains an Author
object. The member values can be obtained by calling methods on
the Author
object.getAnnotations
in class CtMember
java.lang.ClassNotFoundException
CtClass.getAnnotations()
public byte[] getAttribute(java.lang.String name)
CtMember
Note that an attribute is a data block specified by
the class file format.
See AttributeInfo
.
getAttribute
in class CtMember
name
- attribute namepublic java.lang.Object[] getAvailableAnnotations()
CtMember
getAnnotations()
except that, if any annotations are not on the classpath,
they are not included in the returned array.getAvailableAnnotations
in class CtMember
CtMember.getAnnotations()
,
CtClass.getAvailableAnnotations()
public int getModifiers()
CtMember
getModifiers
in class CtMember
javassist.Modifier
.Modifier
public java.lang.String getName()
CtMember
As for constructor names, see getName()
in CtConstructor
.
getName
in class CtMember
CtConstructor.getName()
public java.lang.String getSignature()
CtMember
getSignature()
returns the same string.getSignature
in class CtMember
public void setAttribute(java.lang.String name, byte[] data)
CtMember
Note that an attribute is a data block specified by
the class file format.
See AttributeInfo
.
setAttribute
in class CtMember
name
- attribute namedata
- attribute valuepublic void setModifiers(int mod)
CtMember
setModifiers
in class CtMember
Modifier
public java.lang.String getGenericSignature()
CtMember
getGenericSignature
in class CtMember
SignatureAttribute.toFieldSignature(String)
,
SignatureAttribute.toMethodSignature(String)
,
CtClass.getGenericSignature()
public void setGenericSignature(java.lang.String sig)
CtMember
setGenericSignature
in class CtMember
sig
- a new generic signature.SignatureAttribute.ObjectType.encode()
,
SignatureAttribute.MethodSignature.encode()
,
CtClass.setGenericSignature(String)
CtMember methodHead()
CtMember lastMethod()
CtMember consHead()
CtMember lastCons()
CtMember fieldHead()
CtMember lastField()
void addMethod(CtMember method)
void addConstructor(CtMember cons)
void addField(CtMember field)
void remove(CtMember mem)