alt.jiapi.interceptor
Class FieldInterceptor

java.lang.Object
  extended by alt.jiapi.event.EventProducer
      extended by alt.jiapi.interceptor.FieldInterceptor

public class FieldInterceptor
extends EventProducer

InvocationInterceptor intercepts method invocations and delegates invocations to InvokeHandler.

Following code snippet is an example, how to initialize FieldInterceptor:

      InstrumentationContext ctx = new InstrumentationContext();
      InstrumentationDescriptor id = new InstrumentationDescriptor();
      id.addInclusionRule("samples.*");
      ctx.addInstrumentationDescriptor(id);
       
      FieldInterceptor fi = new FieldInterceptor(id, "samples*", this);
 
FieldInterceptor intercepts only accessess to public fields. NOTE: ONLY FIELD GETS ARE SUPPORTED AT THE MOMENT

Version:
$Revision: 1.3 $ $Date: 2006/01/31 11:11:42 $
Author:
Mika Riekkinen

Constructor Summary
FieldInterceptor(InstrumentationDescriptor id, AccessAdvisor advisor)
          Constructor.
FieldInterceptor(InstrumentationDescriptor id, java.lang.String[] resolutions, AccessAdvisor advisor)
          Creates new InvocationInterceptor.
FieldInterceptor(InstrumentationDescriptor id, java.lang.String resolution, AccessAdvisor advisor)
          Creates new InvocationInterceptor.
 
Method Summary
 java.lang.Object getField(java.lang.Object o, java.lang.String name, java.lang.Object value)
           
 java.lang.Object setField(java.lang.Object o, java.lang.String name, java.lang.Object value)
          Called by Jiapi runtime.
 
Methods inherited from class alt.jiapi.event.EventProducer
getResolutions, isProtected, isProtected, match, protect, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldInterceptor

public FieldInterceptor(InstrumentationDescriptor id,
                        AccessAdvisor advisor)
Constructor. Resolution is set to '*'.

Parameters:
id - Instrumentation decsriptor, that this InvocationInterceptor registers itself to.
handler - InvocationHandler

FieldInterceptor

public FieldInterceptor(InstrumentationDescriptor id,
                        java.lang.String[] resolutions,
                        AccessAdvisor advisor)
Creates new InvocationInterceptor.

Parameters:
id - Instrumentation decsriptor, that this InvocationInterceptor registers itself to.
resolutions - Resolutions, that is used further to select which methods will trigger events to be produced.
handler - InvocationHandler

FieldInterceptor

public FieldInterceptor(InstrumentationDescriptor id,
                        java.lang.String resolution,
                        AccessAdvisor advisor)
Creates new InvocationInterceptor. Resolution tells, which methods are to be intercepted.

Parameters:
id - Instrumentation decsriptor, that this InvocationInterceptor registers itself to.
resolution - Resolution, that is used to select which methods will be intercepted.
handler - InvocationHandler
Method Detail

getField

public java.lang.Object getField(java.lang.Object o,
                                 java.lang.String name,
                                 java.lang.Object value)

setField

public java.lang.Object setField(java.lang.Object o,
                                 java.lang.String name,
                                 java.lang.Object value)
Called by Jiapi runtime.

Parameters:
o - if field-access is being made to an static field, this parameter holds a Class of that field, otherwise this is the instance, that field-access is being acted on.
name - of the field
value - value to set
Returns:
The value that is set on the field


Copyright © 2001. Documenation generated August 26 2011.