|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Instrumentation
An Instrumentation object has transformers that will
be called each time a class is defined or redefined.
The object is given to a premain
function
that is called before the main
function.
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. |
Method Detail |
---|
void addTransformer(ClassFileTransformer transformer)
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
boolean removeTransformer(ClassFileTransformer transformer)
transformer
- the transformer to remove
NullPointerException
- if transformer is nullboolean isRedefineClassesSupported()
void redefineClasses(ClassDefinition[] definitions) throws ClassNotFoundException, UnmodifiableClassException
definitions
- an array of classes to redefine
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 elementisRedefineClassesSupported()
,
addTransformer(java.lang.instrument.ClassFileTransformer)
,
ClassFileTransformer
Class[] getAllLoadedClasses()
Class[] getInitiatedClasses(ClassLoader loader)
loader
- the loader
long getObjectSize(Object objectToSize)
objectToSize
- the object
NullPointerException
- if objectToSize is null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |