|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aspectj.weaver.tools.WeavingAdaptor
public class WeavingAdaptor
This adaptor allows the AspectJ compiler to be embedded in an existing system to facilitate load-time weaving. It provides an interface for a weaving class loader to provide a classpath to be woven by a set of aspects. A callback is supplied to allow a class loader to define classes generated by the compiler during the weaving process.
A weaving class loader should create a WeavingAdaptor
before
any classes are defined, typically during construction. The set of aspects
passed to the adaptor is fixed for the lifetime of the adaptor although the
classpath can be augmented. A system property can be set to allow verbose
weaving messages to be written to the console.
Nested Class Summary | |
---|---|
protected class |
WeavingAdaptor.WeavingAdaptorMessageHolder
Processes messages arising from weaver operations. |
protected class |
WeavingAdaptor.WeavingAdaptorMessageWriter
|
Field Summary | |
---|---|
protected org.aspectj.weaver.bcel.BcelWorld |
bcelWorld
|
protected org.aspectj.weaver.bcel.BcelObjectType |
delegateForCurrentClass
|
protected java.util.Map |
generatedClasses
|
protected GeneratedClassHandler |
generatedClassHandler
|
static java.lang.String |
SHOW_WEAVE_INFO_PROPERTY
|
static java.lang.String |
TRACE_MESSAGES_PROPERTY
|
protected boolean |
verbose
|
protected org.aspectj.weaver.bcel.BcelWeaver |
weaver
|
static java.lang.String |
WEAVING_ADAPTOR_VERBOSE
System property used to turn on verbose weaving messages |
Constructor Summary | |
---|---|
protected |
WeavingAdaptor()
|
|
WeavingAdaptor(GeneratedClassHandler handler,
java.net.URL[] classURLs,
java.net.URL[] aspectURLs)
Construct a WeavingAdator with a reference to a GeneratedClassHandler , a full search path for resolving
classes and a complete set of aspects. |
|
WeavingAdaptor(WeavingClassLoader loader)
Construct a WeavingAdaptor with a reference to a weaving class loader. |
Method Summary | |
---|---|
protected boolean |
accept(java.lang.String name,
byte[] bytes)
|
void |
addURL(java.net.URL url)
Appends URL to path used by the WeavingAdptor to resolve classes |
protected void |
createMessageHandler()
|
protected boolean |
debug(java.lang.String message)
|
protected void |
disable()
|
protected void |
dump(java.lang.String name,
byte[] b,
boolean before)
Dump the given bytcode in _dump/... |
protected void |
enable()
|
protected void |
ensureDelegateInitialized(java.lang.String name,
byte[] bytes)
|
protected boolean |
error(java.lang.String message)
|
protected boolean |
error(java.lang.String message,
java.lang.Throwable th)
|
java.lang.String |
getContextId()
|
protected org.aspectj.bridge.IMessageHandler |
getMessageHandler()
|
org.aspectj.bridge.IMessageHolder |
getMessageHolder()
|
protected boolean |
info(java.lang.String message)
|
protected boolean |
isEnabled()
|
protected void |
setMessageHandler(org.aspectj.bridge.IMessageHandler mh)
|
protected boolean |
shouldDump(java.lang.String name,
boolean before)
|
protected boolean |
warn(java.lang.String message)
|
protected boolean |
warn(java.lang.String message,
java.lang.Throwable th)
|
byte[] |
weaveClass(java.lang.String name,
byte[] bytes)
Weave a class using aspects previously supplied to the adaptor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String WEAVING_ADAPTOR_VERBOSE
public static final java.lang.String SHOW_WEAVE_INFO_PROPERTY
public static final java.lang.String TRACE_MESSAGES_PROPERTY
protected boolean verbose
protected org.aspectj.weaver.bcel.BcelWorld bcelWorld
protected org.aspectj.weaver.bcel.BcelWeaver weaver
protected GeneratedClassHandler generatedClassHandler
protected java.util.Map generatedClasses
protected org.aspectj.weaver.bcel.BcelObjectType delegateForCurrentClass
Constructor Detail |
---|
protected WeavingAdaptor()
public WeavingAdaptor(WeavingClassLoader loader)
loader
- instance of ClassLoader
public WeavingAdaptor(GeneratedClassHandler handler, java.net.URL[] classURLs, java.net.URL[] aspectURLs)
GeneratedClassHandler
, a full search path for resolving
classes and a complete set of aspects. The search path must include
classes loaded by the class loader constructing the WeavingAdaptor and
all its parents in the hierarchy.
handler
- GeneratedClassHandler
classURLs
- the URLs from which to resolve classesaspectURLs
- the aspects used to weave classes defined by this class loaderMethod Detail |
---|
protected void createMessageHandler()
protected org.aspectj.bridge.IMessageHandler getMessageHandler()
public org.aspectj.bridge.IMessageHolder getMessageHolder()
protected void setMessageHandler(org.aspectj.bridge.IMessageHandler mh)
protected void disable()
protected void enable()
protected boolean isEnabled()
public void addURL(java.net.URL url)
url
- to be appended to search pathpublic byte[] weaveClass(java.lang.String name, byte[] bytes) throws java.io.IOException
name
- the name of the classbytes
- the class bytes
java.io.IOException
- weave failedprotected boolean accept(java.lang.String name, byte[] bytes)
protected boolean shouldDump(java.lang.String name, boolean before)
protected void ensureDelegateInitialized(java.lang.String name, byte[] bytes)
protected boolean debug(java.lang.String message)
protected boolean info(java.lang.String message)
protected boolean warn(java.lang.String message)
protected boolean warn(java.lang.String message, java.lang.Throwable th)
protected boolean error(java.lang.String message)
protected boolean error(java.lang.String message, java.lang.Throwable th)
public java.lang.String getContextId()
getContextId
in interface org.aspectj.bridge.IMessageContext
protected void dump(java.lang.String name, byte[] b, boolean before)
name
- b
- before
- whether we are dumping before weaving
java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |