org.aspectj.weaver.loadtime

Class DefaultWeavingContext

Implemented Interfaces:
IWeavingContext

public class DefaultWeavingContext
extends java.lang.Object
implements IWeavingContext

Use in non-OSGi environment
Author:
David Knibb

Field Summary

protected ClassLoader
loader

Constructor Summary

DefaultWeavingContext(ClassLoader loader)
Construct a new WeavingContext to use the specifed ClassLoader This is the constructor which should be used.

Method Summary

String
getBundleIdFromURL(URL url)
String
getClassLoaderName()
List
getDefinitions(ClassLoader loader, WeavingAdaptor adaptor)
Simply call weaving adaptor back to parse aop.xml
String
getFile(URL url)
String
getId()
Enumeration
getResources(String name)
Same as ClassLoader.getResources()
String
getSuffix()
boolean
isLocallyDefined(String classname)
Return true if the classloader associated with this weaving context is the one that will define the class with the specified name.

Field Details

loader

protected ClassLoader loader

Constructor Details

DefaultWeavingContext

public DefaultWeavingContext(ClassLoader loader)
Construct a new WeavingContext to use the specifed ClassLoader This is the constructor which should be used.
Parameters:
loader -

Method Details

getBundleIdFromURL

public String getBundleIdFromURL(URL url)
Specified by:
getBundleIdFromURL in interface IWeavingContext
Returns:
null as we are not in an OSGi environment (therefore no bundles)

getClassLoaderName

public String getClassLoaderName()
Specified by:
getClassLoaderName in interface IWeavingContext
Returns:
classname@hashcode

getDefinitions

public List getDefinitions(ClassLoader loader,
                           WeavingAdaptor adaptor)
Simply call weaving adaptor back to parse aop.xml
Specified by:
getDefinitions in interface IWeavingContext
Parameters:
loader -

getFile

public String getFile(URL url)
Specified by:
getFile in interface IWeavingContext
Returns:
filename

getId

public String getId()
Specified by:
getId in interface IWeavingContext
Returns:
unqualifiedclassname@hashcode

getResources

public Enumeration getResources(String name)
            throws IOException
Same as ClassLoader.getResources()
Specified by:
getResources in interface IWeavingContext

getSuffix

public String getSuffix()

isLocallyDefined

public boolean isLocallyDefined(String classname)
Return true if the classloader associated with this weaving context is the one that will define the class with the specified name. In a delegating classloader hierarchy this might check the parent won't define it and the child will - in OSGi it will do something else.
Specified by:
isLocallyDefined in interface IWeavingContext
Parameters:
classname - name of the class, eg. "java.lang.String"
Returns:
true if the associated classloader will define the class