|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cloudera.lib.lang.ClassUtils
public class ClassUtils
Class related utilities.
| Constructor Summary | |
|---|---|
ClassUtils()
|
|
| Method Summary | |
|---|---|
static void |
createJar(File jarFile,
Class... classes)
Creates a JAR file with the specified classes. |
static void |
createJar(OutputStream os,
Class... classes)
Writes the specified classes to an outputstream. |
static Object |
findConstant(String className,
String constantName)
Finds a constant by name in a class. |
static Method |
findMethod(String className,
String methodName)
Finds a public-static method by name in a class. |
static String |
getJar(Class klass)
Finds the JAR file containing a class. |
static InputStream |
getResource(String name)
Convenience method that returns a resource as inputstream from the classpath. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassUtils()
| Method Detail |
|---|
public static String getJar(Class klass)
klass - class to find its JAR.
public static InputStream getResource(String name)
ClassUtils classloader.
name - resource to retrieve.
public static void createJar(File jarFile,
Class... classes)
throws IOException
jarFile - jar file path.classes - classes to add to the JAR.
IOException - thrown if an IO error occurred.
public static void createJar(OutputStream os,
Class... classes)
throws IOException
os - outputstream to write the classes to.classes - classes to write to the outputstream.
IOException - thrown if an IO error occurred.
public static Method findMethod(String className,
String methodName)
className - name to look for the method.methodName - method name to look in the class.
Method instance.
IllegalArgumentException - thrown if the method does not exist,
it is not public or it is not static.
public static Object findConstant(String className,
String constantName)
throws ServiceException
className - name to look for the method.constantName - constant name to look in the class.
IllegalArgumentException - thrown if the constant does not exist,
it is not public or it is not static.
ServiceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||