Class DefaultWeavingContext

java.lang.Object
org.aspectj.weaver.loadtime.DefaultWeavingContext
All Implemented Interfaces:
IWeavingContext

public class DefaultWeavingContext extends Object implements IWeavingContext
Use in non-OSGi environment
Author:
David Knibb
  • Field Details

  • Constructor Details

    • DefaultWeavingContext

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

    • getResources

      public Enumeration<URL> getResources(String name) throws 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:
      IOException
    • getBundleIdFromURL

      public String getBundleIdFromURL(URL url)
      Description copied from interface: IWeavingContext
      In an OSGi environment, determine which bundle a URL originated from. In a non-OSGi environment, implementors should return null.
      Specified by:
      getBundleIdFromURL in interface IWeavingContext
      Parameters:
      url -
      Returns:
      null as we are not in an OSGi environment (therefore no bundles)
    • getClassLoaderName

      public 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
    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface IWeavingContext
    • getFile

      public String getFile(URL url)
      Description copied from interface: IWeavingContext
      Format a URL
      Specified by:
      getFile in interface IWeavingContext
      Returns:
      filename
    • getId

      public 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 String getSuffix()
    • isLocallyDefined

      public boolean isLocallyDefined(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
    • getDefinitions

      public List<Definition> getDefinitions(ClassLoader loader, WeavingAdaptor adaptor)
      Simply call weaving adaptor back to parse aop.xml
      Specified by:
      getDefinitions in interface IWeavingContext
      Parameters:
      loader -
      adaptor -
      Returns:
      List containing 0 or more Definition instances