public final class PodamUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOG
The application logger.
|
private static int |
SETTER_IDENTIFIER_LENGTH |
| Modifier | Constructor and Description |
|---|---|
private |
PodamUtils()
Non instantiable constructor
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsAnyAnnotation(Field field,
Set<Class<? extends Annotation>> annotations)
Checks if the given field has any one of the annotations
|
static String |
extractFieldNameFromSetterMethod(Method method)
Given a setter
Method, it extracts the field name, according to
JavaBean standards |
static ClassInfo |
getClassInfo(Class<?> clazz)
It returns a
ClassInfo object for the given class |
static ClassInfo |
getClassInfo(Class<?> clazz,
Set<Class<? extends Annotation>> excludeFieldAnnotations)
It returns a
ClassInfo object for the given class |
static Set<String> |
getDeclaredInstanceFields(Class<?> clazz)
Given a class, it returns a Set of its declared instance field names.
|
static Set<String> |
getDeclaredInstanceFields(Class<?> clazz,
Set<Class<? extends Annotation>> excludeAnnotations)
Given a class, it returns a Set of its declared instance field names.
|
static Method |
getGetterFor(Field field)
It returns the getter for the given field.
|
static Set<Method> |
getPojoSetters(Class<?> clazz,
Set<String> classFields)
Given a class and a set of class declared fields it returns a Set of
setters matching the declared fields
|
private static final int SETTER_IDENTIFIER_LENGTH
private static final org.slf4j.Logger LOG
public static ClassInfo getClassInfo(Class<?> clazz)
ClassInfo object for the given classclazz - The class to retrieve info fromClassInfo object for the given classpublic static ClassInfo getClassInfo(Class<?> clazz, Set<Class<? extends Annotation>> excludeFieldAnnotations)
ClassInfo object for the given classclazz - The class to retrieve info fromexcludeFieldAnnotations - the fields marked with any of these annotations will not be
included in the class infoClassInfo object for the given classpublic static Set<String> getDeclaredInstanceFields(Class<?> clazz)
clazz - The class to analyse to retrieve declared fieldspublic static Set<String> getDeclaredInstanceFields(Class<?> clazz, Set<Class<? extends Annotation>> excludeAnnotations)
clazz - The class to analyse to retrieve declared fieldsexcludeAnnotations - fields marked with any of the mentioned annotations will be
skippedpublic static boolean containsAnyAnnotation(Field field, Set<Class<? extends Annotation>> annotations)
field - the field to check forannotations - the set of annotations to look for in the fieldpublic static Method getGetterFor(Field field)
field - The Field for which the getter is requiredpublic static Set<Method> getPojoSetters(Class<?> clazz, Set<String> classFields)
If present, a setter method is considered if and only if the
classFields argument contains an attribute whose name matches the
setter, according to JavaBean standards.
clazz - The class to analyse for settersclassFields - A Set of field names for which setters are to be foundpublic static String extractFieldNameFromSetterMethod(Method method)
Method, it extracts the field name, according to
JavaBean standards
This method, given a setter method, it returns the corresponding attribute name. For example: given setIntField the method would return intField. The correctness of the return value depends on the adherence to JavaBean standards.
method - The setter method from which the field name is requiredCopyright © 2015. All rights reserved.