org.apache.camel.impl
Class DefaultClassResolver

java.lang.Object
  extended by org.apache.camel.impl.DefaultClassResolver
All Implemented Interfaces:
ClassResolver
Direct Known Subclasses:
OsgiClassResolver

public class DefaultClassResolver
extends Object
implements ClassResolver

Default class resolver that uses regular class loader to load classes.


Constructor Summary
DefaultClassResolver()
           
 
Method Summary
protected  Class<?> loadClass(String name, ClassLoader loader)
           
 InputStream loadResourceAsStream(String uri)
          Loads the given resource as a stream
 URL loadResourceAsURL(String uri)
          Loads the given resource as a URL
 Class<?> resolveClass(String name)
          Resolves the given class by its name
<T> Class<T>
resolveClass(String name, Class<T> type)
          Resolves the given class by its name
<T> Class<T>
resolveClass(String name, Class<T> type, ClassLoader loader)
          Resolves the given class by its name
 Class<?> resolveClass(String name, ClassLoader loader)
          Resolves the given class by its name
 Class<?> resolveMandatoryClass(String name)
          Resolves the given class by its name
<T> Class<T>
resolveMandatoryClass(String name, Class<T> type)
          Resolves the given class by its name
<T> Class<T>
resolveMandatoryClass(String name, Class<T> type, ClassLoader loader)
          Resolves the given class by its name
 Class<?> resolveMandatoryClass(String name, ClassLoader loader)
          Resolves the given class by its name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClassResolver

public DefaultClassResolver()
Method Detail

resolveClass

public Class<?> resolveClass(String name)
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveClass in interface ClassResolver
Parameters:
name - full qualified name of class
Returns:
the class if resolved, null if not found.

resolveClass

public <T> Class<T> resolveClass(String name,
                                 Class<T> type)
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveClass in interface ClassResolver
Parameters:
name - full qualified name of class
type - the expected type of the class
Returns:
the class if resolved, null if not found.

resolveClass

public Class<?> resolveClass(String name,
                             ClassLoader loader)
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveClass in interface ClassResolver
Parameters:
name - full qualified name of class
loader - use the provided class loader
Returns:
the class if resolved, null if not found.

resolveClass

public <T> Class<T> resolveClass(String name,
                                 Class<T> type,
                                 ClassLoader loader)
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveClass in interface ClassResolver
Parameters:
name - full qualified name of class
type - the expected type of the class
loader - use the provided class loader
Returns:
the class if resolved, null if not found.

resolveMandatoryClass

public Class<?> resolveMandatoryClass(String name)
                               throws ClassNotFoundException
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveMandatoryClass in interface ClassResolver
Parameters:
name - full qualified name of class
Returns:
the class if resolved, null if not found.
Throws:
ClassNotFoundException - is thrown if class not found

resolveMandatoryClass

public <T> Class<T> resolveMandatoryClass(String name,
                                          Class<T> type)
                               throws ClassNotFoundException
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveMandatoryClass in interface ClassResolver
Parameters:
name - full qualified name of class
type - the expected type of the class
Returns:
the class if resolved, null if not found.
Throws:
ClassNotFoundException - is thrown if class not found

resolveMandatoryClass

public Class<?> resolveMandatoryClass(String name,
                                      ClassLoader loader)
                               throws ClassNotFoundException
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveMandatoryClass in interface ClassResolver
Parameters:
name - full qualified name of class
loader - use the provided class loader
Returns:
the class if resolved, null if not found.
Throws:
ClassNotFoundException - is thrown if class not found

resolveMandatoryClass

public <T> Class<T> resolveMandatoryClass(String name,
                                          Class<T> type,
                                          ClassLoader loader)
                               throws ClassNotFoundException
Description copied from interface: ClassResolver
Resolves the given class by its name

Specified by:
resolveMandatoryClass in interface ClassResolver
Parameters:
name - full qualified name of class
type - the expected type of the class
loader - use the provided class loader
Returns:
the class if resolved, null if not found.
Throws:
ClassNotFoundException - is thrown if class not found

loadResourceAsStream

public InputStream loadResourceAsStream(String uri)
Description copied from interface: ClassResolver
Loads the given resource as a stream

Specified by:
loadResourceAsStream in interface ClassResolver
Parameters:
uri - the uri of the resource
Returns:
as a stream

loadResourceAsURL

public URL loadResourceAsURL(String uri)
Description copied from interface: ClassResolver
Loads the given resource as a URL

Specified by:
loadResourceAsURL in interface ClassResolver
Parameters:
uri - the uri of the resource
Returns:
as a URL

loadClass

protected Class<?> loadClass(String name,
                             ClassLoader loader)


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.