A ClassMetaobject is created for every
class of reflective objects. It can be used to hold values
shared among the reflective objects of the same class.
To obtain a class metaobject, calls _getClass()
on a reflective object. For example,
ClassMetaobject cm = ((Metalevel)reflectiveObject)._getClass();
javassist.tools.reflect.Metaobject , javassist.tools.reflect.Metalevel
| Modifier and Type | Field and Description |
|---|---|
| private Constructor | |
| private Class | |
| pack-priv static final String | methodPrefix
The base-level methods controlled by a metaobject
are renamed so that they begin with
|
| pack-priv static final int | |
| private Method[] | |
| private static final long | serialVersionUID
default serialVersionUID |
| public static boolean | useContextClassLoader
Specifies how a |
| Access | Constructor and Description |
|---|---|
| public | ClassMetaobject(String[]
params[0] is the name of the class
of the reflective objects.Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| private Class | |
| public final Class | |
| public final Method | getMethod(int
the identifier index
given to identifier)trapMethodcall() etc.Returns the |
| public final int | Returns: the identifier index of the original methodThe original name of the reflected method originalName, Class<?>[] array of Class specifying the method signature argTypes)Returns the identifier index of the method, as identified by its original name. |
| public final String | |
| public final String | |
| public final Class | getParameterTypes(int identifier)
Returns an array of |
| public final Method[] | |
| public final Class | getReturnType(int identifier)
Returns a |
| public static Object | |
| public final boolean | |
| public final Object | newInstance(Object[]
the arguments passed to the constructor. args)Creates a new instance of the class. |
| private void | |
| public Object | trapFieldRead(String name)
Is invoked when |
| public void | trapFieldWrite(String name, Object value)
Is invoked when |
| public Object | trapMethodcall(int identifier, Object[] args)
Is invoked when |
| private void |
| constructors | back to summary |
|---|---|
| private Constructor<?>[] constructors | |
| javaClass | back to summary |
|---|---|
| private Class<?> javaClass | |
| methodPrefix | back to summary |
|---|---|
| pack-priv static final String methodPrefix The base-level methods controlled by a metaobject
are renamed so that they begin with
| |
| methodPrefixLen | back to summary |
|---|---|
| pack-priv static final int methodPrefixLen | |
| methods | back to summary |
|---|---|
| private Method[] methods | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID default serialVersionUID | |
| useContextClassLoader | back to summary |
|---|---|
| public static boolean useContextClassLoader Specifies how a If true, it is loaded by: Thread.currentThread().getContextClassLoader().loadClass() If false, it is loaded by | |
| ClassMetaobject | back to summary |
|---|---|
| public ClassMetaobject(String[] params) Constructs a
| |
| getClassObject | back to summary |
|---|---|
| private Class | |
| getJavaClass | back to summary |
|---|---|
| public final Class Obtains the | |
| getMethod | back to summary |
|---|---|
| public final Method getMethod(int identifier) Returns the Note that the actual method returned will be have an altered,
reflective name i.e.
| |
| getMethodIndex | back to summary |
|---|---|
| public final int getMethodIndex(String originalName, Class<?>[] argTypes) throws NoSuchMethodException Returns the identifier index of the method, as identified by its original name. This method is useful, in conjuction with
Written by Brett Randall and Shigeru Chiba.
| |
| getMethodName | back to summary |
|---|---|
| public final String getMethodName(int identifier) Returns the name of the method specified
by | |
| getName | back to summary |
|---|---|
| public final String getName() Obtains the name of this class. | |
| getParameterTypes | back to summary |
|---|---|
| public final Class Returns an array of | |
| getReflectiveMethods | back to summary |
|---|---|
| public final Method[] getReflectiveMethods() Returns an array of the methods defined on the given reflective object. This method is for the internal use only. | |
| getReturnType | back to summary |
|---|---|
| public final Class Returns a | |
| invoke | back to summary |
|---|---|
| public static Object invoke(Object target, int identifier, Object[] args) throws Throwable Invokes a method whose name begins with
| |
| isInstance | back to summary |
|---|---|
| public final boolean isInstance(Object obj) Returns true if | |
| newInstance | back to summary |
|---|---|
| public final Object newInstance(Object[] args) throws CannotCreateException Creates a new instance of the class.
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException | |
| trapFieldRead | back to summary |
|---|---|
| public Object trapFieldRead(String name) Is invoked when Every subclass of this class should redefine this method. | |
| trapFieldWrite | back to summary |
|---|---|
| public void trapFieldWrite(String name, Object value) Is invoked when Every subclass of this class should redefine this method. | |
| trapMethodcall | back to summary |
|---|---|
| public Object trapMethodcall(int identifier, Object[] args) throws Throwable Is invoked when Every subclass of this class should redefine this method. | |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream out) throws IOException | |