AsmClassVisitorFactory

interface AsmClassVisitorFactory<ParametersT : InstrumentationParameters?>


A factory to create class visitor objects to instrument classes.

The implementation of this interface must be an abstract class where the parameters and instrumentationContext are left unimplemented. The class must have an empty constructor which will be used to construct the factory object.

Summary

Public functions

ClassVisitor
createClassVisitor(
    classContext: ClassContext?,
    nextClassVisitor: ClassVisitor?
)

Creates a class visitor object that will visit a class with the given classContext.

Boolean

Whether the factory wants to instrument the class with the given classData.

Public properties

InstrumentationContext

Contains parameters to help instantiate the visitor objects.

Property<ParametersT>

The parameters that will be instantiated, configured using the given config when registering the visitor, and injected on instantiation.

Public functions

createClassVisitor

fun createClassVisitor(
    classContext: ClassContext?,
    nextClassVisitor: ClassVisitor?
): ClassVisitor

Creates a class visitor object that will visit a class with the given classContext. The returned class visitor must delegate its calls to nextClassVisitor. If at this point the factory is not interested in instrumenting the class with given classContext, then return nextClassVisitor.

The given classContext contains static information about the classes before starting the instrumentation process. Any changes in interfaces or superclasses for the class with the given classContext or for any other class in its classpath by a previous visitor will not be reflected in the classContext object.

classContext can also be used to get the data for classes that are in the runtime classpath of the class being visited.

This method must handle asynchronous calls.

Parameters
classContext: ClassContext?

contains information about the class that will be instrumented by the returned class visitor.

nextClassVisitor: ClassVisitor?

the ClassVisitor to which the created ClassVisitor must delegate method calls.

isInstrumentable

fun isInstrumentable(classData: ClassData?): Boolean

Whether the factory wants to instrument the class with the given classData.

If returned true, createClassVisitor will be called and the returned class visitor will visit the class.

This method must handle asynchronous calls.

Public properties

instrumentationContext

val instrumentationContextInstrumentationContext

Contains parameters to help instantiate the visitor objects.

This field must be left unimplemented.

parameters

val parametersProperty<ParametersT>

The parameters that will be instantiated, configured using the given config when registering the visitor, and injected on instantiation.

This field must be left unimplemented.