|
||||||||||
| 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 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 Class |
findClassOfType(URL[] directoryUris,
Class type)
Searches the contents of the directoryUri and returns the first
Class found that is of the given type. |
static List<Method> |
getAllMethods(Class clazz)
Loads all methods from the given clazz (this includes
all super class methods, public, private and protected). |
static ClassLoader |
getClassLoader()
Gets the appropriate class loader instance. |
static List<Class> |
getInterfaces(Class clazz)
Retrieves all interfaces for the given clazz (including clazz
itself, assuming it's an interface as well). |
static List<Class> |
getInterfaces(String className)
Retrieves all interfaces for the given className (including className
itself, assuming it's an interface as well). |
static Class[] |
getInterfacesReversed(String className)
Gets the interfaces for the given className in reverse order. |
protected static Class |
getPrimitiveClass(String name,
ClassLoader loader)
Returns the type class name for a Java primitive. |
static Collection<Object> |
getStaticFieldValues(Class clazz,
Class type)
Returns a collection of all static fields values for the given clazz and type of field. |
static boolean |
isClassOfTypePresent(URL[] directoryUris,
Class type)
Indicates whether or not a class of the given type
is present in one of the given directoryUris. |
protected static boolean |
isPrimitiveType(String name)
Checks if a given type name is a Java primitive type. |
static Class |
loadClass(String className)
Loads and returns the class having the className. |
static Object |
newInstance(Class type)
Creates a new instance of the class given the type. |
static Object |
newInstance(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, getPackageCanonicalName, getPackageCanonicalName, getPackageCanonicalName, getPackageName, getPackageName, getPackageName, getPublicMethod, getShortCanonicalName, getShortCanonicalName, getShortCanonicalName, getShortClassName, getShortClassName, getShortClassName, isAssignable, isAssignable, isAssignable, isAssignable, isInnerClass, primitivesToWrappers, primitiveToWrapper, toClass, wrappersToPrimitives, wrapperToPrimitive |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CLASS_EXTENSION
| Constructor Detail |
|---|
public ClassUtils()
| Method Detail |
|---|
public static Object newInstance(String className)
className.
className - the name of the class to instantiate.
public static Object newInstance(Class type)
type.
type - the type from which to instantiate the new instance.
public static Class loadClass(String className)
className - the name of the class to load.
public static ClassLoader getClassLoader()
protected static Class getPrimitiveClass(String name,
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 Collection<Object> getStaticFieldValues(Class clazz,
Class type)
throws 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
IllegalAccessException - - if some aspect of this static field prevents it from being added to this collection.public static List<Class> getInterfaces(String className)
className (including className
itself, assuming it's an interface as well).
className - the root interface className
public static List<Class> getInterfaces(Class clazz)
clazz (including clazz
itself, assuming it's an interface as well).
clazz - the root interface class
public static Class[] getInterfacesReversed(String className)
className in reverse order.
className - the name of the class for which to retrieve the interfaces
protected static boolean isPrimitiveType(String name)
name - a String with the name of the type
true if name is a Java primitive type; false if not
public static Class findClassOfType(URL[] directoryUris,
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 List<Method> getAllMethods(Class clazz)
clazz (this includes
all super class methods, public, private and protected).
clazz - the class to retrieve the methods.
public static boolean isClassOfTypePresent(URL[] directoryUris,
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 | |||||||||