org.apache.wicket.application
Class CompoundClassResolver

java.lang.Object
  extended by org.apache.wicket.application.CompoundClassResolver
All Implemented Interfaces:
IClassResolver

public class CompoundClassResolver
extends java.lang.Object
implements IClassResolver

A thread safe compound IClassResolver. Class resolving is done by iterating through all IClassResolvers until the class is found. Resource resolving is done by combining the results of all IClassResolvers.

Author:
Jesse Long

Constructor Summary
CompoundClassResolver()
           
 
Method Summary
 CompoundClassResolver add(IClassResolver resolver)
          Adds a resolver
 java.util.Iterator<java.net.URL> getResources(java.lang.String name)
          Tries to load all the resources by the name that is given.
 CompoundClassResolver remove(IClassResolver resolver)
          Removes a resolver
 java.lang.Class<?> resolveClass(java.lang.String className)
          Resolves a class by name (which may or may not involve loading it; thus the name class *resolver* not *loader*).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompoundClassResolver

public CompoundClassResolver()
Method Detail

resolveClass

public java.lang.Class<?> resolveClass(java.lang.String className)
                                throws java.lang.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 IClassResolver trying to load the class until the class is found.

Specified by:
resolveClass in interface IClassResolver
Parameters:
className - The name of the class to resolve.
Returns:
The Class, if it is found.
Throws:
java.lang.ClassNotFoundException - If the class was not found

getResources

public java.util.Iterator<java.net.URL> getResources(java.lang.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 one Set of URLs, and returns an Iterator for the set. URLs are unique in the set.

Specified by:
getResources in interface IClassResolver
Parameters:
name - The name of the resource to find.
Returns:
An Iterator of all the URLs matching the resource name.

add

public CompoundClassResolver add(IClassResolver resolver)
Adds a resolver

Parameters:
resolver - The resolver to add
Returns:
this for chaining

remove

public CompoundClassResolver remove(IClassResolver resolver)
Removes a resolver

Parameters:
resolver - The resolver to remove
Returns:
this for chaining


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.