classpathhelper
Class CGClassLoaderFilterAdapter

java.lang.Object
  extended byclasspathhelper.CGClassLoaderFilterAdapter
All Implemented Interfaces:
CGClassLoaderFilter

public class CGClassLoaderFilterAdapter
extends java.lang.Object
implements CGClassLoaderFilter

Adapter class for CGClassLoaderFilter. Subclasses can optionally overload any method.

Default method implementations are as follows:

Since:
1.1
Author:
bharris

Constructor Summary
CGClassLoaderFilterAdapter()
           
 
Method Summary
 boolean acceptItem(CGClassLoader classLoader, ClassStore classStore)
          Filtering method used to determine if a class store should be allowed by the classloader.
 boolean allowInUnresolved(CGClassLoader classLoader, java.lang.String className)
          Method used to indicate that a class should not be added as unresolved.
 boolean allowsHasBlocked(CGClassLoader classLoader, java.lang.String pathName)
          Method used to indicate if the resource with the supplied name should have its blocked byte code values calculated.
 boolean invertSearchOrder(CGClassLoader classLoader, java.lang.String className)
          Filtering method used to allow some classes to invert the classloading search order for specific classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CGClassLoaderFilterAdapter

public CGClassLoaderFilterAdapter()
Method Detail

acceptItem

public boolean acceptItem(CGClassLoader classLoader,
                          ClassStore classStore)
Description copied from interface: CGClassLoaderFilter

Filtering method used to determine if a class store should be allowed by the classloader.

This method is called during initial construction to determine which class stores and locations to include. It is not called when looking up classes or ClassDetails.

Specified by:
acceptItem in interface CGClassLoaderFilter
Parameters:
classLoader - The classloader where this class store resides.
classStore - The ClassStore.
Returns:
true If this class store should be included on the classpath, otherwise false.

invertSearchOrder

public boolean invertSearchOrder(CGClassLoader classLoader,
                                 java.lang.String className)
Description copied from interface: CGClassLoaderFilter

Filtering method used to allow some classes to invert the classloading search order for specific classes. The practical application of this filtering method is to allow some classes (such as XML parsers) to be searched via the parent classloader even if the classloader is configured to search itself first.

The prefix invert is used to indicate that classes accepted by this filtering method will have the opposite searching order as to that of the class loader. So if a class loader is configured to search itself before its parents an invertedSearchOrder class will search the parent first. If a class loader is configured to search its parent first (the default) an invertedSearchOrder will search the class loader first.

Specified by:
invertSearchOrder in interface CGClassLoaderFilter
Parameters:
classLoader - The class loader this class is being looked up in.
className - The class to look for inverted searching.
Returns:
true If the classes search order should be inverted, otherwise false.

allowsHasBlocked

public boolean allowsHasBlocked(CGClassLoader classLoader,
                                java.lang.String pathName)
Description copied from interface: CGClassLoaderFilter

Method used to indicate if the resource with the supplied name should have its blocked byte code values calculated. In some cases (such as META-INF/MANIFEST.MF blocked bytes are not relavent because that resource is loaded via ClassLoader.getResources(String).

Specified by:
allowsHasBlocked in interface CGClassLoaderFilter
Parameters:
classLoader - The class loader this filter applies to.
pathName - The name of the resource (since using resources, class names appear as package1/package2/SomeClass.class not package1.package2.SomeClass
Returns:
true if this resource should have blocked info calculated otherwise, false

allowInUnresolved

public boolean allowInUnresolved(CGClassLoader classLoader,
                                 java.lang.String className)
Description copied from interface: CGClassLoaderFilter

Method used to indicate that a class should not be added as unresolved. In cases where a class is known not to exist (or its non existence is not important), this will allow the class to not appear as unresolved.

Specified by:
allowInUnresolved in interface CGClassLoaderFilter
Parameters:
classLoader - The class loader the class is from.
className - The name of the class not to add as unresolved.
Returns:
true if this class is allowed to be in other classes unresolved list. Otherwise, false.