Package com.complexible.common.base
Class Instrumentor
- java.lang.Object
-
- com.complexible.common.base.Instrumentor
-
public final class Instrumentor extends java.lang.ObjectSimple -javaagent compatible instrumentor. Provides a premain implementation which grabs a handle to the JVM
Instrumentationand keeps a reference to it for use later on.- Since:
- 2.0 (0.3.3)
- Version:
- 2.0
- Author:
- Michael Grove
-
-
Constructor Summary
Constructors Constructor Description Instrumentor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<java.lang.Class<?>>annotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> theAnnotation)Return all the classes which have the given annotation applied to themstatic <T> java.util.Collection<java.lang.Class<? extends T>>instancesOf(java.lang.Class<T> theClass)Return all the classes loaded into the JVM which extend from the provided classstatic java.lang.instrument.Instrumentationinstrumentation()Return the JVM instrumentationstatic booleanisInitialized()Return whether or not the JVM instrumentation has been initialized via the JVM agentstatic voidpremain(java.lang.String theAgentArgs, java.lang.instrument.Instrumentation theJVMInst)Premain method for use with -javaagent.
-
-
-
Method Detail
-
instrumentation
public static java.lang.instrument.Instrumentation instrumentation()
Return the JVM instrumentation- Returns:
- the instrumentation or null if this was not used as the java agent
-
premain
public static void premain(java.lang.String theAgentArgs, java.lang.instrument.Instrumentation theJVMInst)Premain method for use with -javaagent.- Parameters:
theAgentArgs- the cmd line argstheJVMInst- the JVM instrumentation
-
instancesOf
public static <T> java.util.Collection<java.lang.Class<? extends T>> instancesOf(java.lang.Class<T> theClass)
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
public static java.util.Collection<java.lang.Class<?>> annotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> theAnnotation)
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
-
-