Package javassist
Class CtMember.Cache
- java.lang.Object
-
- javassist.CtMember
-
- javassist.CtMember.Cache
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javassist.CtMember
CtMember.Cache
-
-
Field Summary
Fields Modifier and Type Field Description private CtMember
consTail
private CtMember
fieldTail
private CtMember
methodTail
-
Fields inherited from class javassist.CtMember
declaringClass, next
-
-
Constructor Summary
Constructors Constructor Description Cache(CtClassType decl)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.StringBuilder buffer)
Invoked byCtMember.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 type.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.String clz)
Returns true if the class has the specified annotation type.(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.-
Methods inherited from class javassist.CtMember
getDeclaringClass, hasAnnotation, nameReplaced, next, toString, visibleFrom
-
-
-
-
Constructor Detail
-
Cache
Cache(CtClassType decl)
-
-
Method Detail
-
extendToString
protected void extendToString(java.lang.StringBuilder buffer)
Description copied from class:CtMember
Invoked byCtMember.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.- Specified by:
extendToString
in classCtMember
-
hasAnnotation
public boolean hasAnnotation(java.lang.String clz)
Description copied from class:CtMember
Returns true if the class has the specified annotation type.- Specified by:
hasAnnotation
in classCtMember
- Parameters:
clz
- the name of annotation type.- Returns:
true
if the annotation is found, otherwisefalse
.
-
getAnnotation
public java.lang.Object getAnnotation(java.lang.Class<?> clz) throws java.lang.ClassNotFoundException
Description copied from class:CtMember
Returns the annotation if the class has the specified annotation type. For example, if an annotation@Author
is associated with this member, anAuthor
object is returned. The member values can be obtained by calling methods on theAuthor
object.- Specified by:
getAnnotation
in classCtMember
- Parameters:
clz
- the annotation type.- Returns:
- the annotation if found, otherwise
null
. - Throws:
java.lang.ClassNotFoundException
-
getAnnotations
public java.lang.Object[] getAnnotations() throws java.lang.ClassNotFoundException
Description copied from class:CtMember
Returns the annotations associated with this member. For example, if an annotation@Author
is associated with this member, the returned array contains anAuthor
object. The member values can be obtained by calling methods on theAuthor
object.- Specified by:
getAnnotations
in classCtMember
- Returns:
- an array of annotation-type objects.
- Throws:
java.lang.ClassNotFoundException
- See Also:
CtClass.getAnnotations()
-
getAttribute
public byte[] getAttribute(java.lang.String name)
Description copied from class:CtMember
Obtains a user-defined attribute with the given name. If that attribute is not found in the class file, this method returns null.Note that an attribute is a data block specified by the class file format. See
AttributeInfo
.- Specified by:
getAttribute
in classCtMember
- Parameters:
name
- attribute name
-
getAvailableAnnotations
public java.lang.Object[] getAvailableAnnotations()
Description copied from class:CtMember
Returns the annotations associated with this member. This method is equivalent togetAnnotations()
except that, if any annotations are not on the classpath, they are not included in the returned array.- Specified by:
getAvailableAnnotations
in classCtMember
- Returns:
- an array of annotation-type objects.
- See Also:
CtMember.getAnnotations()
,CtClass.getAvailableAnnotations()
-
getModifiers
public int getModifiers()
Description copied from class:CtMember
Obtains the modifiers of the member.- Specified by:
getModifiers
in classCtMember
- Returns:
- modifiers encoded with
javassist.Modifier
. - See Also:
Modifier
-
getName
public java.lang.String getName()
Description copied from class:CtMember
Obtains the name of the member.As for constructor names, see
getName()
inCtConstructor
.- Specified by:
getName
in classCtMember
- See Also:
CtConstructor.getName()
-
getSignature
public java.lang.String getSignature()
Description copied from class:CtMember
Returns the character string representing the signature of the member. If two members have the same signature (parameter types etc.),getSignature()
returns the same string.- Specified by:
getSignature
in classCtMember
-
setAttribute
public void setAttribute(java.lang.String name, byte[] data)
Description copied from class:CtMember
Adds a user-defined attribute. The attribute is saved in the class file.Note that an attribute is a data block specified by the class file format. See
AttributeInfo
.- Specified by:
setAttribute
in classCtMember
- Parameters:
name
- attribute namedata
- attribute value
-
setModifiers
public void setModifiers(int mod)
Description copied from class:CtMember
Sets the encoded modifiers of the member.- Specified by:
setModifiers
in classCtMember
- See Also:
Modifier
-
getGenericSignature
public java.lang.String getGenericSignature()
Description copied from class:CtMember
Returns the generic signature of the member.- Specified by:
getGenericSignature
in classCtMember
- See Also:
SignatureAttribute.toFieldSignature(String)
,SignatureAttribute.toMethodSignature(String)
,CtClass.getGenericSignature()
-
setGenericSignature
public void setGenericSignature(java.lang.String sig)
Description copied from class:CtMember
Sets the generic signature of the member.- Specified by:
setGenericSignature
in classCtMember
- Parameters:
sig
- a new generic signature.- See Also:
SignatureAttribute.ObjectType.encode()
,SignatureAttribute.MethodSignature.encode()
,CtClass.setGenericSignature(String)
-
methodHead
CtMember methodHead()
-
lastMethod
CtMember lastMethod()
-
consHead
CtMember consHead()
-
lastCons
CtMember lastCons()
-
fieldHead
CtMember fieldHead()
-
lastField
CtMember lastField()
-
addMethod
void addMethod(CtMember method)
-
addConstructor
void addConstructor(CtMember cons)
-
addField
void addField(CtMember field)
-
remove
void remove(CtMember mem)
-
-