|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AgentLoader
Creates a generated class. See Creating an Agent in the description
for Agent
.
Java does not provide a means for creating dynamically generated classes
without creating a custom ClassLoader
or using reflection to
call the protected defineClass
method of an existing
ClassLoader
. This interface gives the user and/or designer of an
agent the choice of class loading mechanisms.
Using a custom ClassLoader
(see CustomLoader
) follows
the more standard class loading model, but at the expense of creating another
class loader branch in the JVM's tree of class loaders, with all the
potential complexities that may imply. Reflection, on the other hand, can
define and load generated classes within an existing class loader scope (see
DelegatingLoader
).
Agent.newInstance(AgentLoader, Class[], AgentTasks, Class)
Method Summary | |
---|---|
Class<?> |
defineClass(String name,
byte[] bytes)
Creates a class generated by an agent. |
ClassLoader |
getClassLoader()
Returns a non-null reference to the effective class loader. |
Method Detail |
---|
ClassLoader getClassLoader()
ClassLoader
is used to directly and indirectly load classes
associated with the agent, including its interfaces and task type (in
order to verify accessibility), as well as generated classes.
Class<?> defineClass(String name, byte[] bytes)
defineClass
method of ClassLoader
.
name
- The class's fully qualified name.bytes
- The generated bytecodes for the class. The offset is
0
, and the length is equal to bytes.length
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |