java.lang.instrument
public interface Instrumentation
premain
function
that is called before the main
function.
Since: 1.5
Method Summary | |
---|---|
void | addTransformer(ClassFileTransformer transformer)
Adds a ClassFileTransformer object
to the instrumentation. |
Class[] | getAllLoadedClasses()
Get all the classes loaded by the JVM.
|
Class[] | getInitiatedClasses(ClassLoader loader)
Get all the classes loaded by a given class loader
|
long | getObjectSize(Object objectToSize)
Get the size of an object. |
boolean | isRedefineClassesSupported()
Returns if the current JVM supports class redefinition
|
void | redefineClasses(ClassDefinition[] definitions)
Redefine classes present in the definitions array, with
the corresponding class files.
|
boolean | removeTransformer(ClassFileTransformer transformer)
Removes the given transformer from the set of transformers
this Instrumentation object has.
|
ClassFileTransformer object
to the instrumentation. Each time a class is defined
or redefined, the transform
method of the
transformer
object is called.
Parameters: transformer the transformer to add
Throws: NullPointerException if transformer is null
Returns: an array containing all the classes loaded by the JVM. The array is empty if no class is loaded.
Parameters: loader the loader
Returns: an array containing all the classes loaded by the given loader. The array is empty if no class was loaded by the loader.
Parameters: objectToSize the object
Returns: the size of the object
Throws: NullPointerException if objectToSize is null.
Returns: true if the current JVM supports class redefinition
Parameters: definitions an array of classes to redefine
Throws: ClassNotFoundException if a class cannot be found UnmodifiableClassException if a class cannot be modified UnsupportedOperationException if the JVM does not support redefinition or the redefinition made unsupported changes ClassFormatError if a class file is not valid NoClassDefFoundError if a class name is not equal to the name in the class file specified UnsupportedClassVersionError if the class file version numbers are unsupported ClassCircularityError if circularity occured with the new classes LinkageError if a linkage error occurs NullPointerException if the definitions array is null, or any of its element
See Also: isRedefineClassesSupported addTransformer ClassFileTransformer
Parameters: transformer the transformer to remove
Returns: true if the transformer was found and removed, false if the transformer was not found
Throws: NullPointerException if transformer is null