Top Description Inners Fields Constructors Methods
javassist

public abstract Class CtMember

extends Object
Class Inheritance
Known Direct Subclasses
javassist.CtMember.Cache, javassist.CtBehavior, javassist.CtField

An instance of CtMember represents a field, a constructor, or a method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
protected CtClass
pack-priv CtMember

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract void
extendToString(StringBuilder buffer)

Invoked by toString() to add to the buffer and provide the complete value.

public abstract Object

Returns:

the annotation if found, otherwise null.
getAnnotation
(Class<?>
the annotation type.
annotationType
)

Returns the annotation if the class has the specified annotation type.

public abstract Object[]

Returns:

an array of annotation-type objects.
getAnnotations
()

Returns the annotations associated with this member.

public abstract byte[]
getAttribute(String
attribute name
name
)

Obtains a user-defined attribute with the given name.

public abstract Object[]

Returns:

an array of annotation-type objects.
getAvailableAnnotations
()

Returns the annotations associated with this member.

public CtClass
getDeclaringClass()

Returns the class that declares this member.

public abstract String
getGenericSignature()

Returns the generic signature of the member.

public abstract int

Returns:

modifiers encoded with javassist.Modifier.
getModifiers
()

Obtains the modifiers of the member.

public abstract String
getName()

Obtains the name of the member.

public abstract String
getSignature()

Returns the character string representing the signature of the member.

public boolean

Returns:

true if the annotation is found, otherwise false.
hasAnnotation
(Class<?>
the annotation type.
clz
)

Returns true if the class has the specified annotation type.

public abstract boolean

Returns:

true if the annotation is found, otherwise false.
hasAnnotation
(String
the name of annotation type.
annotationTypeName
)

Returns true if the class has the specified annotation type.

pack-priv void
nameReplaced()

This method is invoked when setName() or replaceClassName() in CtClass is called.

pack-priv final CtMember
next()

public abstract void
setAttribute(String
attribute name
name
,
byte[]
attribute value
data
)

Adds a user-defined attribute.

public abstract void
setGenericSignature(String
a new generic signature.
sig
)

Sets the generic signature of the member.

public abstract void
setModifiers(int mod)

Sets the encoded modifiers of the member.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
visibleFrom(CtClass clazz)

Returns true if this member is accessible from the given class.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

declaringClassback to summary
protected CtClass declaringClass
nextback to summary
pack-priv CtMember next

Constructor Detail

CtMemberback to summary
protected CtMember(CtClass clazz)

Method Detail

extendToStringback to summary
protected abstract void extendToString(StringBuilder buffer)

Invoked by 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.

getAnnotationback to summary
public abstract Object getAnnotation(Class<?> annotationType) throws ClassNotFoundException

Returns the annotation if the class has the specified annotation type. For example, if an annotation @Author is associated with this member, an Author object is returned. The member values can be obtained by calling methods on the Author object.

Parameters
annotationType:Class<?>

the annotation type.

Returns:Object

the annotation if found, otherwise null.

Since
3.11
getAnnotationsback to summary
public abstract Object[] getAnnotations() throws ClassNotFoundException

Returns the annotations associated with this member. For example, if an annotation @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.

Returns:Object[]

an array of annotation-type objects.

See Also
CtClass#getAnnotations()
getAttributeback to summary
public abstract byte[] getAttribute(String name)

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 javassist.bytecode.AttributeInfo.

Parameters
name:String

attribute name

getAvailableAnnotationsback to summary
public abstract Object[] getAvailableAnnotations()

Returns the annotations associated with this member. This method is equivalent to getAnnotations() except that, if any annotations are not on the classpath, they are not included in the returned array.

Returns:Object[]

an array of annotation-type objects.

Since
3.3
See Also
getAnnotations(), CtClass#getAvailableAnnotations()
getDeclaringClassback to summary
public CtClass getDeclaringClass()

Returns the class that declares this member.

getGenericSignatureback to summary
public abstract String getGenericSignature()

Returns the generic signature of the member.

Since
3.17
See Also
javassist.bytecode.SignatureAttribute#toFieldSignature(String), javassist.bytecode.SignatureAttribute#toMethodSignature(String), CtClass#getGenericSignature()
getModifiersback to summary
public abstract int getModifiers()

Obtains the modifiers of the member.

Returns:int

modifiers encoded with javassist.Modifier.

See Also
Modifier
getNameback to summary
public abstract String getName()

Obtains the name of the member.

As for constructor names, see getName() in CtConstructor.

See Also
CtConstructor#getName()
getSignatureback to summary
public abstract String getSignature()

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.

hasAnnotationback to summary
public boolean hasAnnotation(Class<?> clz)

Returns true if the class has the specified annotation type.

Parameters
clz:Class<?>

the annotation type.

Returns:boolean

true if the annotation is found, otherwise false.

Since
3.11
hasAnnotationback to summary
public abstract boolean hasAnnotation(String annotationTypeName)

Returns true if the class has the specified annotation type.

Parameters
annotationTypeName:String

the name of annotation type.

Returns:boolean

true if the annotation is found, otherwise false.

Since
3.21
nameReplacedback to summary
pack-priv void nameReplaced()

This method is invoked when setName() or replaceClassName() in CtClass is called.

See Also
CtMethod#nameReplaced()
nextback to summary
pack-priv final CtMember next()
setAttributeback to summary
public abstract void setAttribute(String name, byte[] data)

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 javassist.bytecode.AttributeInfo.

Parameters
name:String

attribute name

data:byte[]

attribute value

setGenericSignatureback to summary
public abstract void setGenericSignature(String sig)

Sets the generic signature of the member.

Parameters
sig:String

a new generic signature.

Since
3.17
See Also
javassist.bytecode.SignatureAttribute.ObjectType#encode(), javassist.bytecode.SignatureAttribute.MethodSignature#encode(), CtClass#setGenericSignature(String)
setModifiersback to summary
public abstract void setModifiers(int mod)

Sets the encoded modifiers of the member.

See Also
Modifier
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
visibleFromback to summary
public boolean visibleFrom(CtClass clazz)

Returns true if this member is accessible from the given class.

javassist back to summary

pack-priv Class CtMember.Cache

extends CtMember
Class Inheritance

Field Summary

Modifier and TypeField and Description
private CtMember
private CtMember
private CtMember
Inherited from javassist.CtMember:
declaringClassnext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
pack-priv void
pack-priv CtMember
pack-priv static int
count(CtMember head, CtMember tail)

protected void
extendToString(StringBuilder buffer)

Implements abstract javassist.CtMember.extendToString.

Invoked by toString() to add to the buffer and provide the complete value.

pack-priv CtMember
public Object
getAnnotation(Class<?>
the annotation type.
clz
)

Implements abstract javassist.CtMember.getAnnotation.

Returns the annotation if the class has the specified annotation type.

public Object[]
getAnnotations()

Implements abstract javassist.CtMember.getAnnotations.

Returns the annotations associated with this member.

public byte[]
getAttribute(String
attribute name
name
)

Implements abstract javassist.CtMember.getAttribute.

Obtains a user-defined attribute with the given name.

public Object[]
getAvailableAnnotations()

Implements abstract javassist.CtMember.getAvailableAnnotations.

Returns the annotations associated with this member.

public String
getGenericSignature()

Implements abstract javassist.CtMember.getGenericSignature.

Returns the generic signature of the member.

public int
getModifiers()

Implements abstract javassist.CtMember.getModifiers.

Obtains the modifiers of the member.

public String
getName()

Implements abstract javassist.CtMember.getName.

Obtains the name of the member.

public String
getSignature()

Implements abstract javassist.CtMember.getSignature.

Returns the character string representing the signature of the member.

public boolean
hasAnnotation(String
the name of annotation type.
clz
)

Implements abstract javassist.CtMember.hasAnnotation.

Returns true if the class has the specified annotation type.

pack-priv CtMember
pack-priv CtMember
pack-priv CtMember
pack-priv CtMember
pack-priv void
public void
setAttribute(String
attribute name
name
,
byte[]
attribute value
data
)

Implements abstract javassist.CtMember.setAttribute.

Adds a user-defined attribute.

public void
setGenericSignature(String
a new generic signature.
sig
)

Implements abstract javassist.CtMember.setGenericSignature.

Sets the generic signature of the member.

public void
setModifiers(int mod)

Implements abstract javassist.CtMember.setModifiers.

Sets the encoded modifiers of the member.

Inherited from javassist.CtMember:
getDeclaringClasshasAnnotationnameReplacednexttoStringvisibleFrom

Field Detail

consTailback to summary
private CtMember consTail
fieldTailback to summary
private CtMember fieldTail
methodTailback to summary
private CtMember methodTail

Constructor Detail

Cacheback to summary
pack-priv Cache(CtClassType decl)

Method Detail

addConstructorback to summary
pack-priv void addConstructor(CtMember cons)
addFieldback to summary
pack-priv void addField(CtMember field)
addMethodback to summary
pack-priv void addMethod(CtMember method)
consHeadback to summary
pack-priv CtMember consHead()
countback to summary
pack-priv static int count(CtMember head, CtMember tail)
extendToStringback to summary
protected void extendToString(StringBuilder buffer)

Implements abstract javassist.CtMember.extendToString.

Doc from javassist.CtMember.extendToString.

Invoked by 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.

Annotations
@Override
fieldHeadback to summary
pack-priv CtMember fieldHead()
getAnnotationback to summary
public Object getAnnotation(Class<?> clz) throws ClassNotFoundException

Implements abstract javassist.CtMember.getAnnotation.

Doc from javassist.CtMember.getAnnotation.

Returns the annotation if the class has the specified annotation type. For example, if an annotation @Author is associated with this member, an Author object is returned. The member values can be obtained by calling methods on the Author object.

Parameters
clz:Class<?>

the annotation type.

Returns:Object

the annotation if found, otherwise null.

Annotations
@Override
getAnnotationsback to summary
public Object[] getAnnotations() throws ClassNotFoundException

Implements abstract javassist.CtMember.getAnnotations.

Doc from javassist.CtMember.getAnnotations.

Returns the annotations associated with this member. For example, if an annotation @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.

Returns:Object[]

an array of annotation-type objects.

Annotations
@Override
getAttributeback to summary
public byte[] getAttribute(String name)

Implements abstract javassist.CtMember.getAttribute.

Doc from javassist.CtMember.getAttribute.

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 javassist.bytecode.AttributeInfo.

Parameters
name:String

attribute name

Annotations
@Override
getAvailableAnnotationsback to summary
public Object[] getAvailableAnnotations()

Implements abstract javassist.CtMember.getAvailableAnnotations.

Doc from javassist.CtMember.getAvailableAnnotations.

Returns the annotations associated with this member. This method is equivalent to getAnnotations() except that, if any annotations are not on the classpath, they are not included in the returned array.

Returns:Object[]

an array of annotation-type objects.

Annotations
@Override
getGenericSignatureback to summary
public String getGenericSignature()

Implements abstract javassist.CtMember.getGenericSignature.

Doc from javassist.CtMember.getGenericSignature.

Returns the generic signature of the member.

Annotations
@Override
getModifiersback to summary
public int getModifiers()

Implements abstract javassist.CtMember.getModifiers.

Doc from javassist.CtMember.getModifiers.

Obtains the modifiers of the member.

Returns:int

modifiers encoded with javassist.Modifier.

Annotations
@Override
getNameback to summary
public String getName()

Implements abstract javassist.CtMember.getName.

Doc from javassist.CtMember.getName.

Obtains the name of the member.

As for constructor names, see getName() in CtConstructor.

Annotations
@Override
getSignatureback to summary
public String getSignature()

Implements abstract javassist.CtMember.getSignature.

Doc from javassist.CtMember.getSignature.

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.

Annotations
@Override
hasAnnotationback to summary
public boolean hasAnnotation(String clz)

Implements abstract javassist.CtMember.hasAnnotation.

Doc from javassist.CtMember.hasAnnotation.

Returns true if the class has the specified annotation type.

Parameters
clz:String

the name of annotation type.

Returns:boolean

true if the annotation is found, otherwise false.

Annotations
@Override
lastConsback to summary
pack-priv CtMember lastCons()
lastFieldback to summary
pack-priv CtMember lastField()
lastMethodback to summary
pack-priv CtMember lastMethod()
methodHeadback to summary
pack-priv CtMember methodHead()
removeback to summary
pack-priv void remove(CtMember mem)
setAttributeback to summary
public void setAttribute(String name, byte[] data)

Implements abstract javassist.CtMember.setAttribute.

Doc from javassist.CtMember.setAttribute.

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 javassist.bytecode.AttributeInfo.

Parameters
name:String

attribute name

data:byte[]

attribute value

Annotations
@Override
setGenericSignatureback to summary
public void setGenericSignature(String sig)

Implements abstract javassist.CtMember.setGenericSignature.

Doc from javassist.CtMember.setGenericSignature.

Sets the generic signature of the member.

Parameters
sig:String

a new generic signature.

Annotations
@Override
setModifiersback to summary
public void setModifiers(int mod)

Implements abstract javassist.CtMember.setModifiers.

Doc from javassist.CtMember.setModifiers.

Sets the encoded modifiers of the member.

Annotations
@Override