|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcrom.util.ReflectionUtils
public class ReflectionUtils
Various reflection utility methods, used mainly in the Mapper.
| Constructor Summary | |
|---|---|
ReflectionUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
extendsClass(java.lang.Class type,
java.lang.Class superClass)
Check if a class extends a specific class. |
static java.util.Set<java.lang.Class<?>> |
getClasses(java.lang.ClassLoader loader,
java.lang.String packageName)
|
static java.util.Set<java.lang.Class<?>> |
getClasses(java.lang.String packageName)
|
static java.lang.reflect.Field[] |
getDeclaredAndInheritedFields(java.lang.Class type,
boolean returnFinalFields)
Get an array of all fields declared in the supplied class, and all its superclasses (except java.lang.Object). |
static java.util.Set<java.lang.Class<?>> |
getFromDirectory(java.io.File directory,
java.lang.String packageName)
|
static java.util.Set<java.lang.Class<?>> |
getFromJARFile(java.lang.String jar,
java.lang.String packageName)
|
static JcrNode |
getJcrNodeAnnotation(java.lang.Class c)
|
static java.lang.Class |
getParameterizedClass(java.lang.Class c)
|
static java.lang.Class |
getParameterizedClass(java.lang.Class c,
int index)
|
static java.lang.Class |
getParameterizedClass(java.lang.reflect.Field field)
Get the (first) class that parameterizes the Field supplied. |
static java.lang.Class |
getParameterizedClass(java.lang.reflect.Field field,
int index)
Get the class that parameterizes the Field supplied, at the index supplied (field can be parameterized with multiple param classes). |
static java.lang.Class |
getTypeArgumentOfParameterizedClass(java.lang.reflect.Field field,
int index,
int typeIndex)
|
static java.util.List<java.lang.reflect.Field> |
getValidFields(java.lang.reflect.Field[] fields,
boolean returnFinalFields)
|
static boolean |
implementsInterface(java.lang.Class type,
java.lang.Class interfaceClass)
Check if a class implements a specific interface. |
static boolean |
isDateType(java.lang.Class type)
|
static boolean |
isFieldParameterizedWithClass(java.lang.reflect.Field field,
java.lang.Class c)
Check if a field is parameterized with a specific class. |
static boolean |
isFieldParameterizedWithPropertyType(java.lang.reflect.Field field)
Check if the field supplied is parameterized with a valid JCR property type. |
static boolean |
isPropertyType(java.lang.Class type)
Check if the class supplied represents a valid JCR property type. |
static boolean |
isValidMapValueType(java.lang.Class type)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtils()
| Method Detail |
|---|
public static java.lang.reflect.Field[] getDeclaredAndInheritedFields(java.lang.Class type,
boolean returnFinalFields)
type - the class for which we want to retrieve the FieldsreturnFinalFields - specifies whether to return final fields
public static java.util.List<java.lang.reflect.Field> getValidFields(java.lang.reflect.Field[] fields,
boolean returnFinalFields)
public static boolean implementsInterface(java.lang.Class type,
java.lang.Class interfaceClass)
type - the class we want to checkinterfaceClass - the interface class we want to check against
public static boolean extendsClass(java.lang.Class type,
java.lang.Class superClass)
type - the class we want to checksuperClass - the super class we want to check against
public static boolean isPropertyType(java.lang.Class type)
type - the class we want to check
public static boolean isValidMapValueType(java.lang.Class type)
public static boolean isDateType(java.lang.Class type)
public static java.lang.Class getParameterizedClass(java.lang.reflect.Field field)
field - the field
public static java.lang.Class getParameterizedClass(java.lang.reflect.Field field,
int index)
field - the fieldindex - the index of the parameterizing class
public static java.lang.Class getTypeArgumentOfParameterizedClass(java.lang.reflect.Field field,
int index,
int typeIndex)
public static java.lang.Class getParameterizedClass(java.lang.Class c)
public static java.lang.Class getParameterizedClass(java.lang.Class c,
int index)
public static boolean isFieldParameterizedWithClass(java.lang.reflect.Field field,
java.lang.Class c)
field - the fieldc - the class to check against
public static boolean isFieldParameterizedWithPropertyType(java.lang.reflect.Field field)
field - the field
public static JcrNode getJcrNodeAnnotation(java.lang.Class c)
public static java.util.Set<java.lang.Class<?>> getFromDirectory(java.io.File directory,
java.lang.String packageName)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static java.util.Set<java.lang.Class<?>> getFromJARFile(java.lang.String jar,
java.lang.String packageName)
throws java.io.IOException,
java.io.FileNotFoundException,
java.lang.ClassNotFoundException
java.io.IOException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public static java.util.Set<java.lang.Class<?>> getClasses(java.lang.String packageName)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public static java.util.Set<java.lang.Class<?>> getClasses(java.lang.ClassLoader loader,
java.lang.String packageName)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||