Package org.apache.wicket.application
Class CompoundClassResolver
java.lang.Object
org.apache.wicket.application.CompoundClassResolver
- All Implemented Interfaces:
IClassResolver
A thread safe compound
IClassResolver
. Class resolving is done by iterating through all
IClassResolver
s until the class is found. Resource resolving is done by combining the
results of all IClassResolver
s.- Author:
- Jesse Long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(IClassResolver resolver) Adds a resolverReturns theClassLoader
to be used for resolving classesgetResources
(String name) Tries to load all the resources by the name that is given.remove
(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*).
-
Constructor Details
-
CompoundClassResolver
public CompoundClassResolver()
-
-
Method Details
-
resolveClass
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
IClassResolver
trying to load the class until the class is found.- Specified by:
resolveClass
in 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
Tries to load all the resources by the name that is given.This implementation iterates through all
IClassResolver
s added, and combines the results into oneSet
ofURL
s, and returns anIterator
for the set.URL
s are unique in the set.- Specified by:
getResources
in interfaceIClassResolver
- Parameters:
name
- The name of the resource to find.- Returns:
- An
Iterator
of all theURL
s matching the resource name.
-
getClassLoader
Description copied from interface:IClassResolver
Returns theClassLoader
to be used for resolving classes- Specified by:
getClassLoader
in 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
Adds a resolver- Parameters:
resolver
- The resolver to add- Returns:
this
for chaining
-
remove
Removes a resolver- Parameters:
resolver
- The resolver to remove- Returns:
this
for chaining
-