Package org.apache.wicket.application
Class CompoundClassResolver
- java.lang.Object
-
- org.apache.wicket.application.CompoundClassResolver
-
- All Implemented Interfaces:
IClassResolver
public class CompoundClassResolver extends Object implements IClassResolver
A thread safe compoundIClassResolver. Class resolving is done by iterating through allIClassResolvers until the class is found. Resource resolving is done by combining the results of allIClassResolvers.- Author:
- Jesse Long
-
-
Constructor Summary
Constructors Constructor Description CompoundClassResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompoundClassResolveradd(IClassResolver resolver)Adds a resolverClassLoadergetClassLoader()Returns theClassLoaderto be used for resolving classesIterator<URL>getResources(String name)Tries to load all the resources by the name that is given.CompoundClassResolverremove(IClassResolver resolver)Removes a resolverClass<?>resolveClass(String className)Resolves a class by name (which may or may not involve loading it; thus the name class *resolver* not *loader*).
-
-
-
Method Detail
-
resolveClass
public Class<?> resolveClass(String className) throws ClassNotFoundException
Resolves a class by name (which may or may not involve loading it; thus the name class *resolver* not *loader*).This implementation iterates through all the
IClassResolvertrying to load the class until the class is found.- Specified by:
resolveClassin interfaceIClassResolver- Parameters:
className- The name of the class to resolve.- Returns:
- The
Class, if it is found. - Throws:
ClassNotFoundException- If the class was not found
-
getResources
public Iterator<URL> getResources(String name)
Tries to load all the resources by the name that is given.This implementation iterates through all
IClassResolvers added, and combines the results into oneSetofURLs, and returns anIteratorfor the set.URLs are unique in the set.- Specified by:
getResourcesin interfaceIClassResolver- Parameters:
name- The name of the resource to find.- Returns:
- An
Iteratorof all theURLs matching the resource name.
-
getClassLoader
public ClassLoader getClassLoader()
Description copied from interface:IClassResolverReturns theClassLoaderto be used for resolving classes- Specified by:
getClassLoaderin interfaceIClassResolver- Returns:
- the class loader returned by the first registered IClassResolver. If there is no registered IClassResolver then the current thread's context class loader will be returned.
-
add
public CompoundClassResolver add(IClassResolver resolver)
Adds a resolver- Parameters:
resolver- The resolver to add- Returns:
thisfor chaining
-
remove
public CompoundClassResolver remove(IClassResolver resolver)
Removes a resolver- Parameters:
resolver- The resolver to remove- Returns:
thisfor chaining
-
-