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