Interface Interceptor
-
- All Superinterfaces:
java.lang.Comparable<Interceptor>
public interface Interceptor extends java.lang.Comparable<Interceptor>
Interceptor interface used for byte code modification. A user supplies an implementation of this interface. The calls are invoked as follows:- handleClass is called for the class.
- handleMethod is called for each method defined in the class.
- handleFieldReference is called for each field reference in a class in the order in which they occur. All field references in a method are made available for modification before handleMethod is called for the next method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handleClass(ModifiableClass cls)
Invoked when the GenericClass constructor is called with classdata.void
handleFieldReference(ModifiableFieldReference ref)
Called when a reference to a field is encountered while visiting the body of the method for which handleMethod was most recently called.void
handleMethod(ModifiableMethod method)
Invoked after handleClass for each method defined in the class passed into the GenericClass constructor called with the classdata.java.lang.String
name()
Return the name of the interceptor.
-
-
-
Method Detail
-
name
java.lang.String name()
Return the name of the interceptor.
-
handleClass
void handleClass(ModifiableClass cls)
Invoked when the GenericClass constructor is called with classdata. All Wrapper methods that are available between _class() and _end() may be used to add to cls. This includes adding new methods, fields, constructors, and extending the class initializer. Any changes made to the ModifiableClass argument are included in the resulting GenericClass instance.
-
handleMethod
void handleMethod(ModifiableMethod method)
Invoked after handleClass for each method defined in the class passed into the GenericClass constructor called with the classdata. The ModifiableMethod API may be used to change the method, including adding code before and/or after the existing method body using the usual Wrapper calls for use in a method body.
-
handleFieldReference
void handleFieldReference(ModifiableFieldReference ref)
Called when a reference to a field is encountered while visiting the body of the method for which handleMethod was most recently called.
-
-