classUtils.javassist.sample.reflect
Class VerboseMetaobj

java.lang.Object
  extended by classUtils.javassist.reflect.Metaobject
      extended by classUtils.javassist.sample.reflect.VerboseMetaobj
All Implemented Interfaces:
java.io.Serializable

public class VerboseMetaobj
extends Metaobject

See Also:
Serialized Form

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

VerboseMetaobj

public VerboseMetaobj(java.lang.Object self,
                      java.lang.Object[] args)
Method Detail

trapFieldRead

public java.lang.Object trapFieldRead(java.lang.String name)
Description copied from class: Metaobject
Is invoked when public fields of the base-level class are read and the runtime system intercepts it. This method simply returns the value of the field.

Every subclass of this class should redefine this method.

Overrides:
trapFieldRead in class Metaobject

trapFieldWrite

public void trapFieldWrite(java.lang.String name,
                           java.lang.Object value)
Description copied from class: Metaobject
Is invoked when public fields of the base-level class are modified and the runtime system intercepts it. This method simply sets the field to the given value.

Every subclass of this class should redefine this method.

Overrides:
trapFieldWrite in class Metaobject

trapMethodcall

public java.lang.Object trapMethodcall(int identifier,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
Description copied from class: Metaobject
Is invoked when base-level method invocation is intercepted. This method simply executes the intercepted method invocation with the original parameters and returns the resulting value.

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,

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.

Overrides:
trapMethodcall in class Metaobject
Throws:
java.lang.Throwable