public class Reflect
extends java.lang.Object
Constructor and Description |
---|
Reflect(java.lang.Class parametrizedClass) |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.reflect.Field> |
getAllFields(java.lang.Class<?> fieldClass)
This method return all the fields (including private) from the given class and its super
classes.
|
java.util.List<java.lang.reflect.Field> |
getInheritedFields(java.lang.Class<?> subClass)
This method return all the fields (including private) until the given parameterized class
|
boolean |
hasField(java.lang.reflect.Field field) |
static boolean |
isAnnotationPresent(java.lang.Class<?> fieldClass,
java.lang.String fieldName,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
This method returns true if the given annotation is present on the given field.
|
static boolean |
isCollection(java.lang.Class<?> fieldClass) |
static boolean |
isCollection(java.lang.Object object) |
boolean |
isCollectionField(java.lang.reflect.Field field)
This method validate the given field is Collection and the elements should be of
parameterized type
|
boolean |
isSuperClass(java.lang.Class subClass) |
boolean |
isSuperClass(java.lang.Object object) |
boolean |
isSuperClass(java.lang.reflect.Type t) |
public Reflect(java.lang.Class parametrizedClass)
parametrizedClass
- Classpublic static boolean isCollection(java.lang.Class<?> fieldClass)
fieldClass
- public static boolean isCollection(java.lang.Object object)
object
- Objectpublic static java.util.List<java.lang.reflect.Field> getAllFields(java.lang.Class<?> fieldClass)
fieldClass
- Classpublic static boolean isAnnotationPresent(java.lang.Class<?> fieldClass, java.lang.String fieldName, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
fieldClass
- fieldName
- annotation
- public boolean isSuperClass(java.lang.Class subClass)
subClass
- Classpublic boolean isSuperClass(java.lang.reflect.Type t)
t
- public boolean isSuperClass(java.lang.Object object)
object
- Objectpublic boolean isCollectionField(java.lang.reflect.Field field)
field
- Fieldpublic java.util.List<java.lang.reflect.Field> getInheritedFields(java.lang.Class<?> subClass)
subClass
- Classpublic boolean hasField(java.lang.reflect.Field field)
field
- Copyright © 2018 OpenMRS Inc.. All Rights Reserved.