org.aspectj.weaver.tools
public class WeavingAdaptor extends Object implements org.aspectj.bridge.IMessageContext
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.
Modifier and Type | Class and Description |
---|---|
protected class |
WeavingAdaptor.WeavingAdaptorMessageHolder
Processes messages arising from weaver operations.
|
protected class |
WeavingAdaptor.WeavingAdaptorMessageWriter |
Modifier and Type | Field and Description |
---|---|
protected ProtectionDomain |
activeProtectionDomain |
protected org.aspectj.weaver.bcel.BcelWorld |
bcelWorld |
org.aspectj.weaver.bcel.BcelObjectType |
delegateForCurrentClass |
protected Map<String,org.aspectj.weaver.IUnwovenClassFile> |
generatedClasses |
protected org.aspectj.weaver.tools.GeneratedClassHandler |
generatedClassHandler |
static String |
SHOW_WEAVE_INFO_PROPERTY |
static String |
TRACE_MESSAGES_PROPERTY |
protected boolean |
verbose |
protected org.aspectj.weaver.bcel.BcelWeaver |
weaver |
static String |
WEAVING_ADAPTOR_VERBOSE
System property used to turn on verbose weaving messages
|
Modifier | Constructor and Description |
---|---|
protected |
WeavingAdaptor() |
|
WeavingAdaptor(org.aspectj.weaver.tools.GeneratedClassHandler handler,
URL[] classURLs,
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(org.aspectj.weaver.tools.WeavingClassLoader loader)
Construct a WeavingAdaptor with a reference to a weaving class loader.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(String name,
byte[] bytes) |
void |
addURL(URL url)
Appends URL to path used by the WeavingAdptor to resolve classes
|
protected void |
createMessageHandler() |
protected boolean |
debug(String message) |
protected void |
disable() |
protected void |
dump(String name,
byte[] b,
boolean before)
Dump the given bytcode in _dump/...
|
protected void |
enable() |
protected void |
ensureDelegateInitialized(String name,
byte[] bytes) |
protected boolean |
error(String message) |
protected boolean |
error(String message,
Throwable th) |
String |
getContextId() |
protected String |
getDumpDir() |
protected org.aspectj.bridge.IMessageHandler |
getMessageHandler() |
org.aspectj.bridge.IMessageHolder |
getMessageHolder() |
protected boolean |
info(String message) |
protected boolean |
isEnabled() |
void |
setActiveProtectionDomain(ProtectionDomain protectionDomain) |
protected void |
setMessageHandler(org.aspectj.bridge.IMessageHandler mh) |
protected boolean |
shouldDump(String name,
boolean before) |
protected boolean |
warn(String message) |
protected boolean |
warn(String message,
Throwable th) |
byte[] |
weaveClass(String name,
byte[] bytes)
Weave a class using aspects previously supplied to the adaptor.
|
byte[] |
weaveClass(String name,
byte[] bytes,
boolean mustWeave)
Weave a class using aspects previously supplied to the adaptor.
|
public static final String WEAVING_ADAPTOR_VERBOSE
public static final String SHOW_WEAVE_INFO_PROPERTY
public static final String TRACE_MESSAGES_PROPERTY
protected boolean verbose
protected org.aspectj.weaver.bcel.BcelWorld bcelWorld
protected org.aspectj.weaver.bcel.BcelWeaver weaver
protected org.aspectj.weaver.tools.GeneratedClassHandler generatedClassHandler
public org.aspectj.weaver.bcel.BcelObjectType delegateForCurrentClass
protected ProtectionDomain activeProtectionDomain
protected WeavingAdaptor()
public WeavingAdaptor(org.aspectj.weaver.tools.WeavingClassLoader loader)
loader
- instance of ClassLoader
public WeavingAdaptor(org.aspectj.weaver.tools.GeneratedClassHandler handler, URL[] classURLs, 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 loaderprotected 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(URL url)
url
- to be appended to search pathpublic byte[] weaveClass(String name, byte[] bytes) throws IOException
name
- the name of the classbytes
- the class bytesIOException
- weave failedpublic byte[] weaveClass(String name, byte[] bytes, boolean mustWeave) throws IOException
name
- the name of the classbytes
- the class bytesmustWeave
- if true then this class *must* get woven (used for concrete aspects generated from XML)IOException
- weave failedprotected boolean accept(String name, byte[] bytes)
protected boolean shouldDump(String name, boolean before)
protected void ensureDelegateInitialized(String name, byte[] bytes)
protected boolean debug(String message)
protected boolean info(String message)
protected boolean warn(String message)
protected boolean error(String message)
public String getContextId()
getContextId
in interface org.aspectj.bridge.IMessageContext
protected void dump(String name, byte[] b, boolean before)
name
- b
- before
- whether we are dumping before weavingThrowable
protected String getDumpDir()
public void setActiveProtectionDomain(ProtectionDomain protectionDomain)