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,
String[] resolutions,
AccessAdvisor advisor)
Creates new InvocationInterceptor.
|
FieldInterceptor(InstrumentationDescriptor id,
String resolution,
AccessAdvisor advisor)
Creates new InvocationInterceptor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getField(Object o,
String name,
Object value) |
Object |
setField(Object o,
String name,
Object value)
Called by Jiapi runtime.
|
getResolutions, isProtected, isProtected, match, protect, releasepublic FieldInterceptor(InstrumentationDescriptor id, AccessAdvisor advisor)
id - Instrumentation decsriptor, that this InvocationInterceptor
registers itself to.advisor - AccessAdvisorpublic FieldInterceptor(InstrumentationDescriptor id, 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.advisor - AccessAdvisorpublic FieldInterceptor(InstrumentationDescriptor id, 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.advisor - AccessAdvisorpublic Object setField(Object o, String name, 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 © 2017. All rights reserved.