org.apache.commons.discovery
Class ResourceClass

java.lang.Object
  |
  +--org.apache.commons.discovery.Resource
        |
        +--org.apache.commons.discovery.ResourceClass

public class ResourceClass
extends Resource

'Resource' located by discovery. Naming of methods becomes a real pain ('getClass()') so I've patterned this after ClassLoader... I think it works well as it will give users a point-of-reference.

Author:
Richard A. Sitze

Field Summary
protected  java.lang.Class resourceClass
           
 
Fields inherited from class org.apache.commons.discovery.Resource
loader, name, resource
 
Constructor Summary
ResourceClass(java.lang.Class resourceClass, java.net.URL resource)
           
ResourceClass(java.lang.String resourceName, java.net.URL resource, java.lang.ClassLoader loader)
           
 
Method Summary
 java.lang.Class loadClass()
          Get the value of resourceClass.
static void setLog(org.apache.commons.logging.Log _log)
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.commons.discovery.Resource
getClassLoader, getName, getResource, getResourceAsStream, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resourceClass

protected java.lang.Class resourceClass
Constructor Detail

ResourceClass

public ResourceClass(java.lang.Class resourceClass,
                     java.net.URL resource)

ResourceClass

public ResourceClass(java.lang.String resourceName,
                     java.net.URL resource,
                     java.lang.ClassLoader loader)
Method Detail

setLog

public static void setLog(org.apache.commons.logging.Log _log)

loadClass

public java.lang.Class loadClass()
Get the value of resourceClass. Loading the class does NOT guarentee that the class can be instantiated. Go figure. The class can be instantiated when the class is linked/resolved, and all dependencies are resolved. Various JDKs do this at different times, so beware: java.lang.NoClassDefFoundError when calling Class.getDeclaredMethod() (JDK14), java.lang.reflect.InvocationTargetException (wrapping java.lang.NoClassDefFoundError) when calling java.lang.newInstance (JDK13), and who knows what else..
Returns:
value of resourceClass.

toString

public java.lang.String toString()
Overrides:
toString in class Resource


Copyright (c) 2002 - Apache Software Foundation