|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.lang.ClassUtils
org.andromda.core.common.ClassUtils
public class ClassUtils
Contains utilities for dealing with classes.
| Field Summary | |
|---|---|
static java.lang.String |
CLASS_EXTENSION
The suffix for class files. |
| Fields inherited from class org.apache.commons.lang.ClassUtils |
|---|
INNER_CLASS_SEPARATOR, INNER_CLASS_SEPARATOR_CHAR, PACKAGE_SEPARATOR, PACKAGE_SEPARATOR_CHAR |
| Constructor Summary | |
|---|---|
ClassUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.Class |
findClassOfType(java.net.URL[] directoryUris,
java.lang.Class type)
Searches the contents of the directoryUri and returns the first
Class found that is of the given type. |
static java.util.List |
getAllMethods(java.lang.Class clazz)
Loads all methods from the given clazz (this includes
all super class methods, public, private and protected). |
static java.lang.ClassLoader |
getClassLoader()
Gets the appropriate class loader instance. |
static java.util.List |
getInterfaces(java.lang.Class clazz)
Retrieves all interfaces for the given clazz (including clazz
itself, assuming it's an interface as well). |
static java.util.List |
getInterfaces(java.lang.String className)
Retrieves all interfaces for the given className (including className
itself, assuming it's an interface as well). |
static java.lang.Class[] |
getInterfacesReversed(java.lang.String className)
Gets the interfaces for the given className in reverse order. |
protected static java.lang.Class |
getPrimitiveClass(java.lang.String name,
java.lang.ClassLoader loader)
Returns the type class name for a Java primitive. |
static java.util.Collection |
getStaticFieldValues(java.lang.Class clazz,
java.lang.Class type)
Returns a collection of all static fields values for the given clazz and type of field. |
static boolean |
isClassOfTypePresent(java.net.URL[] directoryUris,
java.lang.Class type)
Indicates whether or not a class of the given type
is present in one of the given directoryUris. |
protected static boolean |
isPrimitiveType(java.lang.String name)
Checks if a given type name is a Java primitive type. |
static java.lang.Class |
loadClass(java.lang.String className)
Loads and returns the class having the className. |
static java.lang.Object |
newInstance(java.lang.Class type)
Creates a new instance of the class given the type. |
static java.lang.Object |
newInstance(java.lang.String className)
Creates a new instance of the class having the given className. |
| Methods inherited from class org.apache.commons.lang.ClassUtils |
|---|
convertClassesToClassNames, convertClassNamesToClasses, getAllInterfaces, getAllSuperclasses, getClass, getClass, getClass, getClass, getPackageName, getPackageName, getPackageName, getPublicMethod, getShortClassName, getShortClassName, getShortClassName, isAssignable, isAssignable, isInnerClass, primitivesToWrappers, primitiveToWrapper |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CLASS_EXTENSION
| Constructor Detail |
|---|
public ClassUtils()
| Method Detail |
|---|
public static java.lang.Object newInstance(java.lang.String className)
className.
className - the name of the class to instantiate.
public static java.lang.Object newInstance(java.lang.Class type)
type.
type - the type from which to instantiate the new instance.
public static java.lang.Class loadClass(java.lang.String className)
className - the name of the class to load.
public static java.lang.ClassLoader getClassLoader()
protected static java.lang.Class getPrimitiveClass(java.lang.String name,
java.lang.ClassLoader loader)
Returns the type class name for a Java primitive.
name - a String with the name of the typeloader - the loader to use.
String with the name of the corresponding
java.lang wrapper class if name is a Java
primitive type; false if not
public static java.util.Collection getStaticFieldValues(java.lang.Class clazz,
java.lang.Class type)
throws java.lang.IllegalAccessException
clazz and type of field.
clazz - the Class from which to retrieve the static fieldstype - the type of static fields to retrieve, if null all are retrieved
java.lang.IllegalAccessExceptionpublic static java.util.List getInterfaces(java.lang.String className)
className (including className
itself, assuming it's an interface as well).
className - the root interface className
public static java.util.List getInterfaces(java.lang.Class clazz)
clazz (including clazz
itself, assuming it's an interface as well).
clazz - the root interface class
public static java.lang.Class[] getInterfacesReversed(java.lang.String className)
className in reverse order.
className - the name of the class for which to retrieve the interfaces
protected static boolean isPrimitiveType(java.lang.String name)
name - a String with the name of the type
true if name is a Java primitive type; false if not
public static java.lang.Class findClassOfType(java.net.URL[] directoryUris,
java.lang.Class type)
directoryUri and returns the first
Class found that is of the given type.
directoryUris - the URIs to search, ie. directories or archives.type - the type to find.
public static java.util.List getAllMethods(java.lang.Class clazz)
clazz (this includes
all super class methods, public, private and protected).
clazz - the class to retrieve the methods.
public static boolean isClassOfTypePresent(java.net.URL[] directoryUris,
java.lang.Class type)
type
is present in one of the given directoryUris.
directoryUris - the URIs to search, ie. directories or archives.type - the type to check.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||