## org.aspectj.weaver.loadtime
Class DefaultWeavingContext

    java.lang.Object
      org.aspectj.weaver.loadtime.DefaultWeavingContext

All Implemented Interfaces:
  IWeavingContext

    public class DefaultWeavingContext

extends java.lang.Object
implements IWeavingContext

Use in non-OSGi environment

Author:
  David Knibb

Field Summary
`protected java.lang.ClassLoader` `loader`

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

Method Summary
`java.lang.String` `getBundleIdFromURL(java.net.URL url)` In an OSGi environment, determin which bundle a URL originated from.
`java.lang.String` `getClassLoaderName()` In an environment with multiple class loaders allows each to be identified using something safer and possibly shorter than toString
`java.lang.String` `getFile(java.net.URL url)` Format a URL
`java.lang.String` `getId()` In an environment with multiple class loaders allows messages to identified according to the weaving context
`java.util.Enumeration` `getResources(java.lang.String name)` Same as ClassLoader.getResources()
`java.lang.String` `getSuffix()`
`boolean` `isLocallyDefined(java.lang.String classname)` Return true if the classloader associated with this weaving context is the one that will define the class with the specified name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### loader

    protected java.lang.ClassLoader loader

Constructor Detail

### DefaultWeavingContext

    public DefaultWeavingContext(java.lang.ClassLoader loader)

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

  Parameters:
    `loader` -

Method Detail

### getResources

    public java.util.Enumeration getResources(java.lang.String name)
                                       throws java.io.IOException

  Same as ClassLoader.getResources()

  Specified by:
    `getResources` in interface `IWeavingContext`
  Parameters:
    `name` - the name of the resource to search for
  Returns:
    an enumeration containing all of the matching resources found
  Throws:
    `java.io.IOException`

### getBundleIdFromURL

    public java.lang.String getBundleIdFromURL(java.net.URL url)

  Description copied from interface: `IWeavingContext`
  In an OSGi environment, determin which bundle a URL originated from. In a non-OSGi environment, implementors should return `null`.

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

### getClassLoaderName

    public java.lang.String getClassLoaderName()

  Description copied from interface: `IWeavingContext`
  In an environment with multiple class loaders allows each to be identified using something safer and possibly shorter than toString

  Specified by:
    `getClassLoaderName` in interface `IWeavingContext`
  Returns:
    classname@hashcode

### getFile

    public java.lang.String getFile(java.net.URL url)

  Description copied from interface: `IWeavingContext`
  Format a URL

  Specified by:
    `getFile` in interface `IWeavingContext`
  Returns:
    filename

### getId

    public java.lang.String getId()

  Description copied from interface: `IWeavingContext`
  In an environment with multiple class loaders allows messages to identified according to the weaving context

  Specified by:
    `getId` in interface `IWeavingContext`
  Returns:
    unqualifiedclassname@hashcode

### getSuffix

    public java.lang.String getSuffix()

### isLocallyDefined

    public boolean isLocallyDefined(java.lang.String classname)

  Description copied from interface: `IWeavingContext`
  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