public class PodamUtils extends Object
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
LOG
The application logger.
|
Modifier | Constructor and Description |
---|---|
private |
PodamUtils()
Non instantiable constructor
|
Modifier and Type | Method and Description |
---|---|
static boolean |
containsAnyAnnotation(Field field,
List<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,
List<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,
List<Class<? extends Annotation>> excludeAnnotations)
Given a class, it returns a Set of its declared instance field names.
|
static Method |
getGetterFor(Field 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
|
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, List<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, List<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, List<Class<? extends Annotation>> annotations)
field
- the field to check forannotations
- the list of annotations to look for in the fieldpublic 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 © 2014. All rights reserved.