| java.lang.Object javassist.CtMember javassist.CtField
Inner Class :abstract public static class Initializer | |
Inner Class :abstract static class CodeInitializer0 extends Initializer | |
Inner Class :static class CodeInitializer extends CodeInitializer0 | |
Inner Class :static class PtreeInitializer extends CodeInitializer0 | |
Inner Class :static class ParamInitializer extends Initializer | |
Inner Class :static class NewInitializer extends Initializer | |
Inner Class :static class MethodInitializer extends NewInitializer | |
Inner Class :static class IntInitializer extends Initializer | |
Inner Class :static class LongInitializer extends Initializer | |
Inner Class :static class DoubleInitializer extends Initializer | |
Inner Class :static class StringInitializer extends Initializer | |
Inner Class :static class ArrayInitializer extends Initializer | |
Inner Class :static class MultiArrayInitializer extends Initializer | |
getAttribute | public byte[] getAttribute(String name)(Code) | | Obtains an 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 - attribute name |
getAvailableAnnotations | public Object[] getAvailableAnnotations()(Code) | | Returns the annotations associated with this field.
If any annotations are not on the classpath, they are not included
in the returned array.
an array of annotation-type objects. See Also: CtField.getAnnotations() since: 3.3 |
getConstantValue | public Object getConstantValue()(Code) | | Returns the value of this field if it is a constant field.
This method works only if the field type is a primitive type
or String type. Otherwise, it returns null .
A constant field is static and final .
a Integer , Long , Float ,Double , Boolean ,or String objectrepresenting the constant value. null if it is not a constant fieldor if the field type is not a primitive typeor String . |
getDeclaringClass | public CtClass getDeclaringClass()(Code) | | Returns the class declaring the field.
|
getFieldInfo | public FieldInfo getFieldInfo()(Code) | | Returns the FieldInfo representing the field in the class file.
|
getFieldInfo2 | public FieldInfo getFieldInfo2()(Code) | | Returns the FieldInfo representing the field in the class
file (read only).
Normal applications do not need calling this method. Use
getFieldInfo() .
The FieldInfo object obtained by this method
is read only. Changes to this object might not be reflected
on a class file generated by toBytecode() ,
toClass() , etc in CtClass .
This method is available even if the CtClass
containing this field is frozen. However, if the class is
frozen, the FieldInfo might be also pruned.
See Also: CtField.getFieldInfo() See Also: CtClass.isFrozen See Also: CtClass.prune |
getInit | Initializer getInit()(Code) | | |
getModifiers | public int getModifiers()(Code) | | Returns the encoded modifiers of the field.
See Also: Modifier |
getName | public String getName()(Code) | | Returns the name of the field.
|
getSignature | public String getSignature()(Code) | | Returns the character string representing the type of the field.
If two fields have the same type,
getSignature() returns the same string.
|
make | public static CtField make(String src, CtClass declaring) throws CannotCompileException(Code) | | Compiles the given source code and creates a field.
Examples of the source code are:
"public String name;"
"public int k = 3;"
Note that the source code ends with ';'
(semicolon).
Parameters: src - the source text. Parameters: declaring - the class to which the created field is added. |
setAttribute | public void setAttribute(String name, byte[] data)(Code) | | Adds an 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 - attribute name Parameters: data - attribute value |
setModifiers | public void setModifiers(int mod)(Code) | | Sets the encoded modifiers of the field.
See Also: Modifier |
setName | public void setName(String newName)(Code) | | Changes the name of the field.
|
setType | public void setType(CtClass clazz)(Code) | | Sets the type of the field.
|
toString | public String toString()(Code) | | Returns a String representation of the object.
|
|
|