public class FieldInterceptor extends EventProducer
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
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getResolutions, isProtected, isProtected, match, protect, release
public FieldInterceptor(InstrumentationDescriptor id, AccessAdvisor advisor)
id
- Instrumentation decsriptor, that this InvocationInterceptor
registers itself to.handler
- InvocationHandlerpublic FieldInterceptor(InstrumentationDescriptor id, java.lang.String[] resolutions, AccessAdvisor advisor)
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
- InvocationHandlerpublic FieldInterceptor(InstrumentationDescriptor id, java.lang.String resolution, AccessAdvisor advisor)
id
- Instrumentation decsriptor, that this InvocationInterceptor
registers itself to.resolution
- Resolution, that is used to select which
methods will be intercepted.handler
- InvocationHandlerpublic java.lang.Object getField(java.lang.Object o, java.lang.String name, java.lang.Object value)
public java.lang.Object setField(java.lang.Object o, java.lang.String name, java.lang.Object value)
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 fieldvalue
- value to setCopyright © 2001. Documenation generated January 20 2015.