public class ClassUtils extends org.apache.commons.lang.ClassUtils
Modifier and Type | Field and Description |
---|---|
static String |
CLASS_EXTENSION
The suffix for class files.
|
Constructor and Description |
---|
ClassUtils() |
Modifier and Type | Method and Description |
---|---|
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 . |
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
public static final String CLASS_EXTENSION
public ClassUtils()
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 notpublic 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 retrievedIllegalAccessException
- - 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 classNamepublic static List<Class> getInterfaces(Class clazz)
clazz
(including clazz
itself, assuming it's an interface as well).clazz
- the root interface classpublic static Class[] getInterfacesReversed(String className)
className
in reverse order.className
- the name of the class for which to retrieve the interfacesprotected static boolean isPrimitiveType(String name)
Checks if a given type name is a Java primitive type.
name
- a String
with the name of the typetrue
if name
is a Java primitive type; false
if notpublic 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.Copyright © 2003–2014 AndroMDA.org. All rights reserved.