org.apache.camel.spi
Interface ClassResolver

All Known Implementing Classes:
DefaultClassResolver, OsgiClassResolver

public interface ClassResolver

A class resolver for loading classes in a loosly coupled manner to cater for different platforms such as standalone, web container, j2ee container and OSGi platforms.


Method Summary
 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
 

Method Detail

resolveClass

Class<?> resolveClass(String name)
Resolves the given class by its name

Parameters:
name - full qualified name of class
Returns:
the class if resolved, null if not found.

resolveClass

<T> Class<T> resolveClass(String name,
                          Class<T> type)
Resolves the given class by its name

Parameters:
name - full qualified name of class
type - the expected type of the class
Returns:
the class if resolved, null if not found.

resolveClass

Class<?> resolveClass(String name,
                      ClassLoader loader)
Resolves the given class by its name

Parameters:
name - full qualified name of class
loader - use the provided class loader
Returns:
the class if resolved, null if not found.

resolveClass

<T> Class<T> resolveClass(String name,
                          Class<T> type,
                          ClassLoader loader)
Resolves the given class by its name

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

Class<?> resolveMandatoryClass(String name)
                               throws ClassNotFoundException
Resolves the given class by its name

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

<T> Class<T> resolveMandatoryClass(String name,
                                   Class<T> type)
                               throws ClassNotFoundException
Resolves the given class by its name

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

Class<?> resolveMandatoryClass(String name,
                               ClassLoader loader)
                               throws ClassNotFoundException
Resolves the given class by its name

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

<T> Class<T> resolveMandatoryClass(String name,
                                   Class<T> type,
                                   ClassLoader loader)
                               throws ClassNotFoundException
Resolves the given class by its name

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

InputStream loadResourceAsStream(String uri)
Loads the given resource as a stream

Parameters:
uri - the uri of the resource
Returns:
as a stream

loadResourceAsURL

URL loadResourceAsURL(String uri)
Loads the given resource as a URL

Parameters:
uri - the uri of the resource
Returns:
as a URL


Apache CAMEL