org.apache.hivemind.impl
Class DefaultClassResolver

java.lang.Object
  extended by org.apache.hivemind.impl.DefaultClassResolver
All Implemented Interfaces:
ClassResolver

public class DefaultClassResolver
extends java.lang.Object
implements ClassResolver

Default implementation of ClassResolver based around Thread.getContextClassLoader() (which is set by the servlet container).

Author:
Howard Lewis Ship

Constructor Summary
DefaultClassResolver()
          Constructs a new instance using Thread.getContextClassLoader().
DefaultClassResolver(java.lang.ClassLoader loader)
           
 
Method Summary
 java.lang.Class checkForClass(java.lang.String type)
          Like ClassResolver.findClass(String), but simply returns null if the class does not exist (i.e., if ClassNotFoundException is thrown).
 java.lang.Class findClass(java.lang.String type)
          Invokes Class.forName(java.lang.String, boolean, java.lang.ClassLoader).
 java.lang.ClassLoader getClassLoader()
          Returns a ClassLoader that can see all the classes the resolver can access.
 java.net.URL getResource(java.lang.String name)
          Forwarded, unchanged, to the class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClassResolver

public DefaultClassResolver()
Constructs a new instance using Thread.getContextClassLoader().


DefaultClassResolver

public DefaultClassResolver(java.lang.ClassLoader loader)
Method Detail

getResource

public java.net.URL getResource(java.lang.String name)
Description copied from interface: ClassResolver
Forwarded, unchanged, to the class loader. Returns null if the resource is not found.

Specified by:
getResource in interface ClassResolver

findClass

public java.lang.Class findClass(java.lang.String type)
Invokes Class.forName(java.lang.String, boolean, java.lang.ClassLoader).

Specified by:
findClass in interface ClassResolver
Parameters:
type - the complete class name to locate and load; alternately, may be a primitive name or an array type (primitive or object)
Returns:
The loaded class
Throws:
ApplicationRuntimeException - if loading the class throws an exception (typically ClassNotFoundException or a security exception)
See Also:
JavaTypeUtils

checkForClass

public java.lang.Class checkForClass(java.lang.String type)
Description copied from interface: ClassResolver
Like ClassResolver.findClass(String), but simply returns null if the class does not exist (i.e., if ClassNotFoundException is thrown). This is used in certain spots when (typically) the exact package for a class is not known.

Specified by:
checkForClass in interface ClassResolver

getClassLoader

public java.lang.ClassLoader getClassLoader()
Description copied from interface: ClassResolver
Returns a ClassLoader that can see all the classes the resolver can access.

Specified by:
getClassLoader in interface ClassResolver


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.