|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectclassUtils.javassist.reflect.Metaobject
classUtils.javassist.sample.reflect.VerboseMetaobj
public class VerboseMetaobj
Constructor Summary | |
---|---|
VerboseMetaobj(java.lang.Object self,
java.lang.Object[] args)
|
Method Summary | |
---|---|
java.lang.Object |
trapFieldRead(java.lang.String name)
Is invoked when public fields of the base-level class are read and the runtime system intercepts it. |
void |
trapFieldWrite(java.lang.String name,
java.lang.Object value)
Is invoked when public fields of the base-level class are modified and the runtime system intercepts it. |
java.lang.Object |
trapMethodcall(int identifier,
java.lang.Object[] args)
Is invoked when base-level method invocation is intercepted. |
Methods inherited from class classUtils.javassist.reflect.Metaobject |
---|
getClassMetaobject, getMethodName, getObject, getParameterTypes, getReturnType, setObject |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VerboseMetaobj(java.lang.Object self, java.lang.Object[] args)
Method Detail |
---|
public java.lang.Object trapFieldRead(java.lang.String name)
Metaobject
Every subclass of this class should redefine this method.
trapFieldRead
in class Metaobject
public void trapFieldWrite(java.lang.String name, java.lang.Object value)
Metaobject
Every subclass of this class should redefine this method.
trapFieldWrite
in class Metaobject
public java.lang.Object trapMethodcall(int identifier, java.lang.Object[] args) throws java.lang.Throwable
Metaobject
Every subclass of this class should redefine this method.
Note: this method is not invoked if the base-level method is invoked by a constructor in the super class. For example,
abstract class A { abstract void initialize(); A() { initialize(); // not intercepted } } class B extends A { void initialize() { System.out.println("initialize()"); } B() { super(); initialize(); // intercepted } }
if an instance of B is created, the invocation of initialize() in B is intercepted only once. The first invocation by the constructor in A is not intercepted. This is because the link between a base-level object and a metaobject is not created until the execution of a constructor of the super class finishes.
trapMethodcall
in class Metaobject
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |