org.jboss.soa.esb.util
Class ClassUtil

java.lang.Object
  extended by org.jboss.soa.esb.util.ClassUtil

public class ClassUtil
extends java.lang.Object

Utility methods to aid in class/resource loading.

Author:
kevin

Constructor Summary
ClassUtil()
           
 
Method Summary
static java.lang.Class forName(java.lang.String className, java.lang.Class caller)
          Load the specified class.
static java.lang.String getPath(java.lang.Package packageObj)
          Get a package name and convert it to a path value, so it can be used in calls to methods like getResourceAsStream(java.lang.String, java.lang.Class).
static java.io.InputStream getResourceAsStream(java.lang.String resourceName, java.lang.Class caller)
          Get the specified resource as a stream.
static java.util.List<java.lang.String> getResourceList(java.lang.String regex, java.lang.Class caller)
           
static java.lang.Class resolveProxy(java.lang.String[] interfaces, java.lang.Class caller)
          Resolve a proxy for the specified interfaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtil

public ClassUtil()
Method Detail

forName

public static java.lang.Class forName(java.lang.String className,
                                      java.lang.Class caller)
                               throws java.lang.ClassNotFoundException
Load the specified class.

Parameters:
className - The name of the class to load.
caller - The class of the caller.
Returns:
The specified class.
Throws:
java.lang.ClassNotFoundException - If the class cannot be found.

resolveProxy

public static java.lang.Class resolveProxy(java.lang.String[] interfaces,
                                           java.lang.Class caller)
                                    throws java.lang.ClassNotFoundException
Resolve a proxy for the specified interfaces.

Parameters:
interfaces - The interfaces associated with the proxy.
caller - The class of the caller.
Returns:
The specified proxy class.
Throws:
java.lang.ClassNotFoundException - If the class cannot be found.

getResourceAsStream

public static java.io.InputStream getResourceAsStream(java.lang.String resourceName,
                                                      java.lang.Class caller)
Get the specified resource as a stream.

Parameters:
resourceName - The name of the class to load.
caller - The class of the caller.
Returns:
The input stream for the resource or null if not found.

getPath

public static java.lang.String getPath(java.lang.Package packageObj)
Get a package name and convert it to a path value, so it can be used in calls to methods like getResourceAsStream(java.lang.String, java.lang.Class).

Adds a '/' prefix and converts all '." characters to '/'. Doesn't add a trailing slash.

Parameters:
packageObj - The package.
Returns:
The package path.

getResourceList

public static java.util.List<java.lang.String> getResourceList(java.lang.String regex,
                                                               java.lang.Class caller)