Package com.complexible.common.base

# Class Instrumentor

java.lang.Object
com.complexible.common.base.Instrumentor

public final class Instrumentor extends Object

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
  Constructor
  Description
  `Instrumentor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Collection<Class<?>>`
  `annotatedWith(Class<? extends Annotation> theAnnotation)`
  Return all the classes which have the given annotation applied to them
  `static <T> Collection<Class<? extends T>>`
  `instancesOf(Class<T> theClass)`
  Return all the classes loaded into the JVM which extend from the provided class
  `static Instrumentation`
  `instrumentation()`
  Return the JVM instrumentation
  `static boolean`
  `isInitialized()`
  Return whether or not the JVM instrumentation has been initialized via the JVM agent
  `static void`
  `premain(String theAgentArgs, Instrumentation theJVMInst)`
  Premain method for use with -javaagent.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Instrumentor

    public Instrumentor()

- ## Method Details

  - ### instrumentation

    public static 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(String theAgentArgs, Instrumentation theJVMInst)
    Premain method for use with -javaagent.
    Parameters:
      `theAgentArgs` - the cmd line args
      `theJVMInst` - the JVM instrumentation

  - ### instancesOf

    public static <T> Collection<Class<? extends T>> instancesOf(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 Collection<Class<?>> annotatedWith(Class<? extends 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