org.datanucleus.util
Class ClassUtils

java.lang.Object
  extended by org.datanucleus.util.ClassUtils

public class ClassUtils
extends java.lang.Object

Utilities for handling classes. These are to supplement the methods provided by the Class object.


Field Summary
protected static java.util.Map constructorsCache
          caching for constructors - using caching, the perf is at least doubled
protected static Localiser LOCALISER
          Localisation utility for output messages
 
Constructor Summary
ClassUtils()
           
 
Method Summary
static void assertClassForJarExistsInClasspath(ClassLoaderResolver clr, java.lang.String className, java.lang.String jarName)
          Convenience method to throw a NucleusUserException if the specified class is not loadable from the ClassLoaderResolver.
static boolean classesAreDescendents(ClassLoaderResolver clr, java.lang.String class_name_1, java.lang.String class_name_2)
          Method to check if 2 classes are direct descendents.
static java.lang.Object convertValue(java.lang.Object value, java.lang.Class cls)
          Convenience method to convert the passed value to an object of the specified type (if possible).
static java.lang.String createFullClassName(java.lang.String pkg_name, java.lang.String cls_name)
          Utility to create the full class name given the package and class name.
static void dumpClassInformation(java.lang.Class cls)
          Utility to use Reflection to dump out the details of a class.
static java.util.Collection getClassFilesForDirectory(java.io.File dir, boolean normal_classes, boolean inner_classes)
          Method to return the class files below the specified directory.
static java.lang.Class getClassForMemberOfClass(java.lang.Class cls, java.lang.String memberName)
          Method that returns the class type of a member of the specified class (if present).
static java.lang.String getClassNameForClass(java.lang.Class cls)
          Utility to return the class name without the package name for a class.
static java.lang.String getClassnameForFilename(java.lang.String filename, java.lang.String rootfilename)
          Utility to get the Class name given the file name and the file name of the root of the package structure.
static java.lang.String getClassNameForFileURL(java.net.URL fileURL)
          Utility to find the class name of a class given the absolute file name of its class file.
static java.lang.String[] getClassNamesForDirectoryAndBelow(java.io.File dir)
          Convenience method to return the names of classes specified in the directory and below.
static java.lang.String[] getClassNamesForJarFile(java.lang.String jarFileName)
          Convenience accessor for the names of all class files in the jar file with the specified name.
static java.lang.String[] getClassNamesForJarFile(java.net.URL jarFileURL)
          Convenience accessor for the names of all class files in the jar file with the specified URL.
static java.lang.String getCollectionElementType(java.lang.Class type, java.lang.reflect.Type genericType)
          Convenience method to extract the element type of a collection when using JDK1.5 generics given the input field.
static java.lang.String getCollectionElementType(java.lang.reflect.Field field)
          Convenience method to extract the element type of a collection when using JDK1.5 generics given the input field.
static java.lang.String getCollectionElementType(java.lang.reflect.Method method)
          Convenience method to extract the element type of a collection when using JDK1.5 generics, given the input method (getter).
static java.lang.reflect.Constructor getConstructorWithArguments(java.lang.Class cls, java.lang.Class[] types)
          Convenience method to return the constructor of the passed class that accepts the supplied argument types.
static java.lang.reflect.Field getFieldForClass(java.lang.Class cls, java.lang.String fieldName)
          Obtain a field from a class or superclasses using reflection.
static java.lang.String getFieldNameForJavaBeanGetter(java.lang.String methodName)
          Generate a field name for JavaBeans compatible getter method
static java.lang.String getFieldNameForJavaBeanSetter(java.lang.String methodName)
          Generate a field name for JavaBeans compatible setter method
static java.lang.reflect.Method getGetterMethodForClass(java.lang.Class cls, java.lang.String beanName)
          Obtain a (Java bean) getter method from a class or superclasses using reflection.
static java.lang.String getJavaBeanGetterName(java.lang.String fieldName, boolean isBoolean)
          Generate a JavaBeans compatible getter name
static java.lang.String getJavaBeanSetterName(java.lang.String fieldName)
          Generate a JavaBeans compatible setter name
static java.lang.String getJavaLangClassForType(java.lang.String type)
          Convenience method to return the passed type as a java.lang type wherever possible.
static java.lang.String getMapKeyType(java.lang.Class type, java.lang.reflect.Type genericType)
          Convenience method to extract the key type of a map when using JDK1.5 generics given the input field.
static java.lang.String getMapKeyType(java.lang.reflect.Field field)
          Convenience method to extract the key type of a map when using JDK1.5 generics given the input field.
static java.lang.String getMapKeyType(java.lang.reflect.Method method)
          Convenience method to extract the key type of a map when using JDK1.5 generics given the input method.
static java.lang.String getMapValueType(java.lang.Class type, java.lang.reflect.Type genericType)
          Convenience method to extract the value type of a map when using JDK1.5 generics given the input field
static java.lang.String getMapValueType(java.lang.reflect.Field field)
          Convenience method to extract the value type of a map when using JDK1.5 generics given the input field
static java.lang.String getMapValueType(java.lang.reflect.Method method)
          Convenience method to extract the value type of a map when using JDK1.5 generics given the input method.
static java.lang.reflect.Method getMethodForClass(java.lang.Class cls, java.lang.String methodName, java.lang.Class[] argtypes)
          Obtain a method from a class or superclasses using reflection
static java.lang.reflect.Method getMethodWithArgument(java.lang.Class cls, java.lang.String methodName, java.lang.Class argType)
          Obtain a method from a class or superclasses using reflection.
static int getModifiersForFieldOfClass(ClassLoaderResolver clr, java.lang.String className, java.lang.String fieldName)
          Convenience accessor for the modifiers of a field in a class.
static java.lang.String[] getPackageJdoFilesForJarFile(java.lang.String jarFileName)
          Convenience accessor for the names of all "package.jdo" files in the jar file with the specified name.
static java.lang.String[] getPackageJdoFilesForJarFile(java.net.URL jarFileURL)
          Convenience accessor for the names of all "package.jdo" files in the jar file with the specified URL.
static java.lang.String getPackageNameForClass(java.lang.Class cls)
          Utility to return the package name for a class.
static java.lang.Class getPrimitiveTypeForType(java.lang.Class type)
          Method to return the primitive equivalent of the specified type (if any).
static java.util.Collection getSuperclasses(java.lang.Class the_class)
          Method to return the superclasses for a class.
static java.util.Collection getSuperinterfaces(java.lang.Class the_class)
          Method to return the superinterfaces for a class.
static java.lang.Object getValueForIdentityField(java.lang.Object id, java.lang.String fieldName)
          Method to find the value of a field of the provided user-defined identity.
static java.lang.Object getValueOfFieldByReflection(java.lang.Object object, java.lang.String fieldName)
          Helper method to return the value of a field of an object using reflection.
static java.lang.Object getValueOfMethodByReflection(java.lang.Object object, java.lang.String methodName, java.lang.Object... args)
          Helper method to return the value returned by a method on an object using reflection.
static java.lang.Class getWrapperTypeForPrimitiveType(java.lang.Class type)
          Convenience method to return the object wrapper type for a primitive type.
static java.lang.String getWrapperTypeNameForPrimitiveTypeName(java.lang.String typeName)
          Convenience method to return the object wrapper type for a primitive type name.
static boolean hasDefaultConstructor(java.lang.Class the_class)
          Method to check for a default constructor on a class.
static boolean isInnerClass(java.lang.String class_name)
          Method to check whether a classname is for an inner class.
static boolean isPrimitiveArrayType(java.lang.String typeName)
          Convenience method to return if the passed type (name) is a primitive array type.
static boolean isPrimitiveType(java.lang.String typeName)
          Convenience method to return if the passed type (name) is a primitive type.
static boolean isPrimitiveWrapperType(java.lang.String typeName)
          Convenience method to return if the passed type (name) is a primitive wrapper type.
static boolean isReferenceType(java.lang.Class cls)
          Method to return whether the passes type is a "reference" type.
static java.lang.Object newInstance(java.lang.Class type, java.lang.Class[] parameterTypes, java.lang.Object[] parameters)
          Accessor for a new instance of an object.
static boolean stringArrayContainsValue(java.lang.String[] array, java.lang.String value)
          Convenience method to return if a String array contains a value.
static boolean typesAreCompatible(java.lang.Class cls1, java.lang.Class cls2)
          Convenience method to return if two types are compatible.
static boolean typesAreCompatible(java.lang.Class cls1, java.lang.String clsName2, ClassLoaderResolver clr)
          Convenience method to return if two types are compatible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation utility for output messages


constructorsCache

protected static java.util.Map constructorsCache
caching for constructors - using caching, the perf is at least doubled

Constructor Detail

ClassUtils

public ClassUtils()
Method Detail

newInstance

public static java.lang.Object newInstance(java.lang.Class type,
                                           java.lang.Class[] parameterTypes,
                                           java.lang.Object[] parameters)
Accessor for a new instance of an object. Uses reflection to generate the instance using the passed constructor parameter arguments.

Parameters:
type - Type of object (the class).
parameterTypes - Classes of params for the constructor
parameters - The parameters for the constructor
Returns:
The object
Throws:
NucleusException - If an error occurs creating the instance

getConstructorWithArguments

public static java.lang.reflect.Constructor getConstructorWithArguments(java.lang.Class cls,
                                                                        java.lang.Class[] types)
Convenience method to return the constructor of the passed class that accepts the supplied argument types. Allows for primitive to primitive wrapper conversion. Typically used by the JDOQL ResultClass mapping process.

Parameters:
cls - The class
types - The constructor argument types
Returns:
The constructor

getMethodWithArgument

public static java.lang.reflect.Method getMethodWithArgument(java.lang.Class cls,
                                                             java.lang.String methodName,
                                                             java.lang.Class argType)
Obtain a method from a class or superclasses using reflection. The method will have the specified name and will take a single argument. Allows for the argument type being primitive or its associated wrapper.

Parameters:
cls - the class to find the declared fields and populate the map
methodName - the method name to find
argType - the argument type

getMethodForClass

public static java.lang.reflect.Method getMethodForClass(java.lang.Class cls,
                                                         java.lang.String methodName,
                                                         java.lang.Class[] argtypes)
Obtain a method from a class or superclasses using reflection

Parameters:
cls - the class where to look for the method
methodName - the method name to find
argtypes - the classes argument of the method
Returns:
The Method

getClassnameForFilename

public static java.lang.String getClassnameForFilename(java.lang.String filename,
                                                       java.lang.String rootfilename)
Utility to get the Class name given the file name and the file name of the root of the package structure.

Parameters:
filename - The filename of the class file
rootfilename - The filename of the root of the package structure
Returns:
The Class name

getClassFilesForDirectory

public static java.util.Collection getClassFilesForDirectory(java.io.File dir,
                                                             boolean normal_classes,
                                                             boolean inner_classes)
Method to return the class files below the specified directory.

Parameters:
dir - The directory
normal_classes - Whether to include normal classes
inner_classes - Whether to include inner classes
Returns:
The class files (Collection of File objects).

getClassNamesForJarFile

public static java.lang.String[] getClassNamesForJarFile(java.lang.String jarFileName)
Convenience accessor for the names of all class files in the jar file with the specified name. The returned class names are of the form "org.datanucleus.MyClass".

Parameters:
jarFileName - Name of the jar file
Returns:
The class names

getClassNamesForJarFile

public static java.lang.String[] getClassNamesForJarFile(java.net.URL jarFileURL)
Convenience accessor for the names of all class files in the jar file with the specified URL. The returned class names are of the form "org.datanucleus.MyClass".

Parameters:
jarFileURL - URL for the jar file
Returns:
The class names

getPackageJdoFilesForJarFile

public static java.lang.String[] getPackageJdoFilesForJarFile(java.lang.String jarFileName)
Convenience accessor for the names of all "package.jdo" files in the jar file with the specified name.

Parameters:
jarFileName - Name of the jar file
Returns:
The "package.jdo" file names

getPackageJdoFilesForJarFile

public static java.lang.String[] getPackageJdoFilesForJarFile(java.net.URL jarFileURL)
Convenience accessor for the names of all "package.jdo" files in the jar file with the specified URL.

Parameters:
jarFileURL - URL for the jar file
Returns:
The "package.jdo" file names

getClassNamesForDirectoryAndBelow

public static java.lang.String[] getClassNamesForDirectoryAndBelow(java.io.File dir)
Convenience method to return the names of classes specified in the directory and below. All inner classes are ignored.

Parameters:
dir - Directory that we should look below (root of classpath)
Returns:
The class names

isInnerClass

public static boolean isInnerClass(java.lang.String class_name)
Method to check whether a classname is for an inner class. Currently checks for the presence of $ in the name.

Parameters:
class_name - The class name
Returns:
Whether it is an inner class

hasDefaultConstructor

public static boolean hasDefaultConstructor(java.lang.Class the_class)
Method to check for a default constructor on a class. Particular relevance for JDO is the requirement for a default constructor on all Persistence-Capable classes. Doesn't check superclasses for the default constructor.

Parameters:
the_class - The class
Returns:
Whether it has a default constructor

getSuperclasses

public static java.util.Collection getSuperclasses(java.lang.Class the_class)
Method to return the superclasses for a class. The superclasses will be ordered.

Parameters:
the_class - The class
Returns:
The superclass of this class.

getSuperinterfaces

public static java.util.Collection getSuperinterfaces(java.lang.Class the_class)
Method to return the superinterfaces for a class. The superinterfaces will be ordered.

Parameters:
the_class - The class
Returns:
The superinterfaces of this class.

getFieldForClass

public static java.lang.reflect.Field getFieldForClass(java.lang.Class cls,
                                                       java.lang.String fieldName)
Obtain a field from a class or superclasses using reflection.

Parameters:
cls - the class to find the field from
fieldName - the field name to find
Returns:
The Field

getGetterMethodForClass

public static java.lang.reflect.Method getGetterMethodForClass(java.lang.Class cls,
                                                               java.lang.String beanName)
Obtain a (Java bean) getter method from a class or superclasses using reflection.

Parameters:
cls - the class to find the getter from
beanName - the name of the java bean to find the getter for
Returns:
The getter Method

getWrapperTypeNameForPrimitiveTypeName

public static java.lang.String getWrapperTypeNameForPrimitiveTypeName(java.lang.String typeName)
Convenience method to return the object wrapper type for a primitive type name. If the type is not a primitive then just returns the type name

Parameters:
typeName - The primitive type name
Returns:
The object wrapper type name for this primitive

getWrapperTypeForPrimitiveType

public static java.lang.Class getWrapperTypeForPrimitiveType(java.lang.Class type)
Convenience method to return the object wrapper type for a primitive type.

Parameters:
type - The primitive type
Returns:
The object wrapper type for this primitive

getPrimitiveTypeForType

public static java.lang.Class getPrimitiveTypeForType(java.lang.Class type)
Method to return the primitive equivalent of the specified type (if any). Returns null if there is no primitive equivalent.

Parameters:
type - The type
Returns:
The primitive equivalent.

isPrimitiveWrapperType

public static boolean isPrimitiveWrapperType(java.lang.String typeName)
Convenience method to return if the passed type (name) is a primitive wrapper type.

Parameters:
typeName - Name of the type
Returns:
Whether it is a primitive wrapper

isPrimitiveArrayType

public static boolean isPrimitiveArrayType(java.lang.String typeName)
Convenience method to return if the passed type (name) is a primitive array type.

Parameters:
typeName - Name of the type
Returns:
Whether it is a primitive array

isPrimitiveType

public static boolean isPrimitiveType(java.lang.String typeName)
Convenience method to return if the passed type (name) is a primitive type.

Parameters:
typeName - Name of the type
Returns:
Whether it is a primitive

convertValue

public static java.lang.Object convertValue(java.lang.Object value,
                                            java.lang.Class cls)
Convenience method to convert the passed value to an object of the specified type (if possible). If no such conversion is supported will return null. If the required type is a primitive will return an object of the wrapper type.

Parameters:
value - The value
cls - The class
Returns:
The converted value (or null)

typesAreCompatible

public static boolean typesAreCompatible(java.lang.Class cls1,
                                         java.lang.String clsName2,
                                         ClassLoaderResolver clr)
Convenience method to return if two types are compatible. Returns true if both types are primitive/wrappers and are of the same type. Returns true if clsName2 is the same or a subclass of cls1. Otherwise returns false;

Parameters:
cls1 - First class
clsName2 - Name of the second class
clr - ClassLoader resolver to use
Returns:
Whether they are compatible

typesAreCompatible

public static boolean typesAreCompatible(java.lang.Class cls1,
                                         java.lang.Class cls2)
Convenience method to return if two types are compatible. Returns true if both types are primitive/wrappers and are of the same type. Returns true if cls2 is the same or a subclass of cls1. Otherwise returns false;

Parameters:
cls1 - First class
cls2 - Second class
Returns:
Whether they are compatible

createFullClassName

public static java.lang.String createFullClassName(java.lang.String pkg_name,
                                                   java.lang.String cls_name)
Utility to create the full class name given the package and class name. Some examples
 packageName=test className=Test, returns result=test.Test
 packageName=test className=test1.Test, returns result=test1.Test
 packageName=<null> className=Test, returns result=Test
 packageName=<null> className=test1.Test, returns result=test1.Test
 

Parameters:
pkg_name - package name.
cls_name - class name.
Returns:
generated full class name.

getJavaLangClassForType

public static java.lang.String getJavaLangClassForType(java.lang.String type)
Convenience method to return the passed type as a java.lang type wherever possible. The passed type will be stripped of any package name and will be checked if it is a known java.lang class. This is used where the user has specified a class name for a collection or map element/key/value type and meant a java.lang class but didn't fully qualify it.

Parameters:
type - The type name
Returns:
The java.lang equivalent (or the input type if not possible)

classesAreDescendents

public static boolean classesAreDescendents(ClassLoaderResolver clr,
                                            java.lang.String class_name_1,
                                            java.lang.String class_name_2)
Method to check if 2 classes are direct descendents. So one of them is a superclass of the other.

Parameters:
clr - ClassLoaderResolver for loading the classes
class_name_1 - Name of first class
class_name_2 - Name of second class
Returns:
Whether they are direct descendents.

dumpClassInformation

public static void dumpClassInformation(java.lang.Class cls)
Utility to use Reflection to dump out the details of a class. Will list all superclasses, interfaces, methods and fields. Can be used, for example, in checking the methods adding by the enhancement process. The information is dumped out the JPOX GENERAL log.

Parameters:
cls - The class to dump out to the log

getJavaBeanGetterName

public static java.lang.String getJavaBeanGetterName(java.lang.String fieldName,
                                                     boolean isBoolean)
Generate a JavaBeans compatible getter name

Parameters:
fieldName - the field name
isBoolean - whether the field is primitive boolean type
Returns:
the getter name

getJavaBeanSetterName

public static java.lang.String getJavaBeanSetterName(java.lang.String fieldName)
Generate a JavaBeans compatible setter name

Parameters:
fieldName - the field name
Returns:
the setter name

getFieldNameForJavaBeanGetter

public static java.lang.String getFieldNameForJavaBeanGetter(java.lang.String methodName)
Generate a field name for JavaBeans compatible getter method

Parameters:
methodName - the method name
Returns:
the field name

getFieldNameForJavaBeanSetter

public static java.lang.String getFieldNameForJavaBeanSetter(java.lang.String methodName)
Generate a field name for JavaBeans compatible setter method

Parameters:
methodName - the method name
Returns:
the field name

getClassNameForFileURL

public static java.lang.String getClassNameForFileURL(java.net.URL fileURL)
                                               throws java.lang.ClassNotFoundException
Utility to find the class name of a class given the absolute file name of its class file. Creates a loader and loads the class directly to find it.

Parameters:
fileURL - URL for the class file
Returns:
The name of the class
Throws:
java.lang.ClassNotFoundException - Thrown when the file is not found

getPackageNameForClass

public static java.lang.String getPackageNameForClass(java.lang.Class cls)
Utility to return the package name for a class. Allows for the result of class.getPackage() being null.

Parameters:
cls - The class
Returns:
The name of its package (or null if no package e.g a primitive)

getClassNameForClass

public static java.lang.String getClassNameForClass(java.lang.Class cls)
Utility to return the class name without the package name for a class.

Parameters:
cls - The class
Returns:
The name of the class without its package

getCollectionElementType

public static java.lang.String getCollectionElementType(java.lang.reflect.Field field)
Convenience method to extract the element type of a collection when using JDK1.5 generics given the input field.

Parameters:
field - The field
Returns:
The name of the element class

getCollectionElementType

public static java.lang.String getCollectionElementType(java.lang.Class type,
                                                        java.lang.reflect.Type genericType)
Convenience method to extract the element type of a collection when using JDK1.5 generics given the input field.

Parameters:
type - the field type
genericType - the generic type
Returns:
The name of the element class

getCollectionElementType

public static java.lang.String getCollectionElementType(java.lang.reflect.Method method)
Convenience method to extract the element type of a collection when using JDK1.5 generics, given the input method (getter).

Parameters:
method - The method
Returns:
The name of the element class

getMapKeyType

public static java.lang.String getMapKeyType(java.lang.reflect.Field field)
Convenience method to extract the key type of a map when using JDK1.5 generics given the input field.

Parameters:
field - The field
Returns:
The name of the key class

getMapKeyType

public static java.lang.String getMapKeyType(java.lang.Class type,
                                             java.lang.reflect.Type genericType)
Convenience method to extract the key type of a map when using JDK1.5 generics given the input field.

Parameters:
type - the field type
genericType - the generic type
Returns:
The name of the key class

getMapKeyType

public static java.lang.String getMapKeyType(java.lang.reflect.Method method)
Convenience method to extract the key type of a map when using JDK1.5 generics given the input method.

Parameters:
method - The method
Returns:
The name of the key class

getMapValueType

public static java.lang.String getMapValueType(java.lang.reflect.Field field)
Convenience method to extract the value type of a map when using JDK1.5 generics given the input field

Parameters:
field - The field
Returns:
The name of the value class

getMapValueType

public static java.lang.String getMapValueType(java.lang.Class type,
                                               java.lang.reflect.Type genericType)
Convenience method to extract the value type of a map when using JDK1.5 generics given the input field

Parameters:
type - the field type
genericType - the generic type
Returns:
The name of the value class

getMapValueType

public static java.lang.String getMapValueType(java.lang.reflect.Method method)
Convenience method to extract the value type of a map when using JDK1.5 generics given the input method.

Parameters:
method - The method
Returns:
The name of the value class

getModifiersForFieldOfClass

public static int getModifiersForFieldOfClass(ClassLoaderResolver clr,
                                              java.lang.String className,
                                              java.lang.String fieldName)
Convenience accessor for the modifiers of a field in a class.

Parameters:
clr - ClassLoader resolver
className - Name of the class
fieldName - Name of the field
Returns:
The modifiers

isReferenceType

public static boolean isReferenceType(java.lang.Class cls)
Method to return whether the passes type is a "reference" type. A "reference" type is either an interface or an Object, so can be used as a reference to a persistable object.

Parameters:
cls - The type
Returns:
Whether it is a reference type

assertClassForJarExistsInClasspath

public static void assertClassForJarExistsInClasspath(ClassLoaderResolver clr,
                                                      java.lang.String className,
                                                      java.lang.String jarName)
Convenience method to throw a NucleusUserException if the specified class is not loadable from the ClassLoaderResolver.

Parameters:
clr - ClassLoader resolver
className - Name of the class
jarName - Name of the jar containing the class
Throws:
NucleusUserException - if the class is not found

stringArrayContainsValue

public static boolean stringArrayContainsValue(java.lang.String[] array,
                                               java.lang.String value)
Convenience method to return if a String array contains a value.

Parameters:
array - The String array
value - The value
Returns:
Whether it is contained

getValueOfMethodByReflection

public static java.lang.Object getValueOfMethodByReflection(java.lang.Object object,
                                                            java.lang.String methodName,
                                                            java.lang.Object... args)
Helper method to return the value returned by a method on an object using reflection.

Parameters:
object - The object
methodName - Name of the method
Returns:
The value

getValueOfFieldByReflection

public static java.lang.Object getValueOfFieldByReflection(java.lang.Object object,
                                                           java.lang.String fieldName)
Helper method to return the value of a field of an object using reflection.

Parameters:
object - The object
fieldName - Name of the field
Returns:
The value

getValueForIdentityField

public static java.lang.Object getValueForIdentityField(java.lang.Object id,
                                                        java.lang.String fieldName)
Method to find the value of a field of the provided user-defined identity. The field has to be either accessible, or have a Java-bean style getter.

Parameters:
id - The identity
fieldName - Name of the field
Returns:
The value of the field in this identity
Throws:
NucleusUserException - if not possible to get the value

getClassForMemberOfClass

public static java.lang.Class getClassForMemberOfClass(java.lang.Class cls,
                                                       java.lang.String memberName)
Method that returns the class type of a member of the specified class (if present). The member can either be a field, or a Java bean name (for a getter).

Parameters:
cls - The class
memberName - The member name
Returns:
The member class (or null if not present)


Copyright © 2010. All Rights Reserved.