Top Description Fields Constructors Methods
org.aspectj.weaver.loadtime

public Class DefaultWeavingContext

extends Object
implements IWeavingContext
Class Inheritance
All Implemented Interfaces
org.aspectj.weaver.loadtime.IWeavingContext
Imports
java.io.IOException, java.net.URL, java.util.Enumeration, .List, org.aspectj.weaver.bcel.BcelWeakClassLoaderReference, org.aspectj.weaver.loadtime.definition.Definition, org.aspectj.weaver.tools.Trace, .TraceFactory, .WeavingAdaptor

Use in non-OSGi environment
Author
David Knibb

Field Summary

Modifier and TypeField and Description
protected BcelWeakClassLoaderReference
private String
private static Trace

Constructor Summary

AccessConstructor and Description
public
DefaultWeavingContext(ClassLoader loader)

Construct a new WeavingContext to use the specified ClassLoader This is the constructor which should be used.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

null as we are not in an OSGi environment (therefore no bundles)
getBundleIdFromURL
(URL url)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getBundleIdFromURL.

In an OSGi environment, determine which bundle a URL originated from.
public ClassLoader
public String

Returns:

classname@hashcode
getClassLoaderName
()

Implements org.aspectj.weaver.loadtime.IWeavingContext.getClassLoaderName.

In an environment with multiple class loaders allows each to be identified using something safer and possibly shorter than toString
public List<Definition>
getDefinitions(final ClassLoader loader, final WeavingAdaptor adaptor)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getDefinitions.

Simply call weaving adaptor back to parse aop.xml
public String

Returns:

filename
getFile
(URL url)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getFile.

Format a URL
public String

Returns:

unqualifiedclassname@hashcode
getId
()

Implements org.aspectj.weaver.loadtime.IWeavingContext.getId.

In an environment with multiple class loaders allows messages to identified according to the weaving context
public Enumeration<URL>
getResources(String
the name of the resource to search for
name
)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getResources.

Same as ClassLoader.getResources()
public String
public boolean
isLocallyDefined(String
name of the class, eg. "java.lang.String"
classname
)

Implements org.aspectj.weaver.loadtime.IWeavingContext.isLocallyDefined.

Return true if the classloader associated with this weaving context is the one that will define the class with the specified name.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loaderRefback to summary
protected BcelWeakClassLoaderReference loaderRef
shortNameback to summary
private String shortName
traceback to summary
private static Trace trace

Constructor Detail

DefaultWeavingContextback to summary
public DefaultWeavingContext(ClassLoader loader)

Construct a new WeavingContext to use the specified ClassLoader This is the constructor which should be used.

Method Detail

getBundleIdFromURLback to summary
public String getBundleIdFromURL(URL url)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getBundleIdFromURL.

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getBundleIdFromURL.

In an OSGi environment, determine which bundle a URL originated from. In a non-OSGi environment, implementors should return null.

Returns:String

null as we are not in an OSGi environment (therefore no bundles)

getClassLoaderback to summary
public ClassLoader getClassLoader()

Implements org.aspectj.weaver.loadtime.IWeavingContext.getClassLoader.

getClassLoaderNameback to summary
public String getClassLoaderName()

Implements org.aspectj.weaver.loadtime.IWeavingContext.getClassLoaderName.

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getClassLoaderName.

In an environment with multiple class loaders allows each to be identified using something safer and possibly shorter than toString

Returns:String

classname@hashcode

getDefinitionsback to summary
public List<Definition> getDefinitions(final ClassLoader loader, final WeavingAdaptor adaptor)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getDefinitions.

Simply call weaving adaptor back to parse aop.xml

Returns:List<Definition>

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getDefinitions.

List containing 0 or more Definition instances

getFileback to summary
public String getFile(URL url)

Implements org.aspectj.weaver.loadtime.IWeavingContext.getFile.

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getFile.

Format a URL

Returns:String

filename

getIdback to summary
public String getId()

Implements org.aspectj.weaver.loadtime.IWeavingContext.getId.

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getId.

In an environment with multiple class loaders allows messages to identified according to the weaving context

Returns:String

unqualifiedclassname@hashcode

getResourcesback to summary
public Enumeration<URL> getResources(String name) throws IOException

Implements org.aspectj.weaver.loadtime.IWeavingContext.getResources.

Same as ClassLoader.getResources()

Parameters
name:String

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getResources.

the name of the resource to search for

Returns:Enumeration<URL>

Doc from org.aspectj.weaver.loadtime.IWeavingContext.getResources.

an enumeration containing all of the matching resources found

getSuffixback to summary
public String getSuffix()
isLocallyDefinedback to summary
public boolean isLocallyDefined(String classname)

Implements org.aspectj.weaver.loadtime.IWeavingContext.isLocallyDefined.

Doc from org.aspectj.weaver.loadtime.IWeavingContext.isLocallyDefined.

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.

Parameters
classname:String

name of the class, eg. "java.lang.String"

Returns:boolean

true if the associated classloader will define the class