Package com.complexible.common.base
Class Instrumentor
java.lang.Object
com.complexible.common.base.Instrumentor
Simple -javaagent compatible instrumentor. Provides a premain implementation which grabs a handle to the JVM Instrumentation and keeps a reference
to it for use later on.
- Since:
- 2.0 (0.3.3)
- Version:
- 2.0
- Author:
- Michael Grove
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Class<?>> annotatedWith(Class<? extends Annotation> theAnnotation) Return all the classes which have the given annotation applied to themstatic <T> Collection<Class<? extends T>> instancesOf(Class<T> theClass) Return all the classes loaded into the JVM which extend from the provided classstatic InstrumentationReturn the JVM instrumentationstatic booleanReturn whether or not the JVM instrumentation has been initialized via the JVM agentstatic voidpremain(String theAgentArgs, Instrumentation theJVMInst) Premain method for use with -javaagent.
-
Constructor Details
-
Instrumentor
public Instrumentor()
-
-
Method Details
-
instrumentation
Return the JVM instrumentation- Returns:
- the instrumentation or null if this was not used as the java agent
-
premain
Premain method for use with -javaagent.- Parameters:
theAgentArgs- the cmd line argstheJVMInst- the JVM instrumentation
-
instancesOf
Return all the classes loaded into the JVM which extend from the provided class- Type Parameters:
T- the base class type- Parameters:
theClass- the class- Returns:
- all the classes extending from the parameter. An empty collection will be returned if this java agent is not installed
-
annotatedWith
Return all the classes which have the given annotation applied to them- Parameters:
theAnnotation- the annotation- Returns:
- the classes with the annotation. An empty collection will be returned if this java agent is not installed
-
isInitialized
public static boolean isInitialized()Return whether or not the JVM instrumentation has been initialized via the JVM agent- Returns:
- true if initialized, false otherwise
-