public class CompoundClassResolver extends Object implements IClassResolver
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.Constructor and Description |
---|
CompoundClassResolver() |
Modifier and Type | Method and Description |
---|---|
CompoundClassResolver |
add(IClassResolver resolver)
Adds a resolver
|
ClassLoader |
getClassLoader()
Returns the
ClassLoader to be used for resolving classes |
Iterator<URL> |
getResources(String name)
Tries to load all the resources by the name that is given.
|
CompoundClassResolver |
remove(IClassResolver resolver)
Removes a resolver
|
Class<?> |
resolveClass(String className)
Resolves a class by name (which may or may not involve loading it; thus the name class
*resolver* not *loader*).
|
public Class<?> resolveClass(String className) throws ClassNotFoundException
This implementation iterates through all the IClassResolver
trying to load the class
until the class is found.
resolveClass
in interface IClassResolver
className
- The name of the class to resolve.Class
, if it is found.ClassNotFoundException
- If the class was not foundpublic Iterator<URL> getResources(String name)
This implementation iterates through all IClassResolver
s added, and combines the
results into one Set
of URL
s, and returns an Iterator
for the set.
URL
s are unique in the set.
getResources
in interface IClassResolver
name
- The name of the resource to find.Iterator
of all the URL
s matching the resource name.public ClassLoader getClassLoader()
IClassResolver
ClassLoader
to be used for resolving classesgetClassLoader
in interface IClassResolver
public CompoundClassResolver add(IClassResolver resolver)
resolver
- The resolver to addthis
for chainingpublic CompoundClassResolver remove(IClassResolver resolver)
resolver
- The resolver to removethis
for chainingCopyright © 2006–2022 Apache Software Foundation. All rights reserved.