uk.co.jemos.podam.utils
Class PodamUtils

java.lang.Object
  extended by uk.co.jemos.podam.utils.PodamUtils

public class PodamUtils
extends Object

PODAM Utility class.

Author:
mtedone

Constructor Summary
private PodamUtils()
          Non instantiable constructor
 
Method Summary
static String extractClassNameFromParameterisedTypeInField(Type type)
          Given a Type object, it extracts and returns the class name
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 Set<String> getDeclaredInstanceFields(Class<?> clazz)
          Given a class, it returns a Set of its declared instance field names.
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PodamUtils

private PodamUtils()
Non instantiable constructor

Method Detail

getClassInfo

public static ClassInfo getClassInfo(Class<?> clazz)
It returns a ClassInfo object for the given class

Parameters:
clazz - The class to retrieve info from
Returns:
a ClassInfo object for the given class

getDeclaredInstanceFields

public static Set<String> getDeclaredInstanceFields(Class<?> clazz)
Given a class, it returns a Set of its declared instance field names.

Parameters:
clazz - The class to analyse to retrieve declared fields
Returns:
Set of a class declared field names.

getPojoSetters

public 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

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.

Parameters:
clazz - The class to analyse for setters
classFields - A Set of field names for which setters are to be found
Returns:
A Set of setters matching the class declared field names

extractFieldNameFromSetterMethod

public static String extractFieldNameFromSetterMethod(Method method)
Given a setter 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.

Parameters:
method - The setter method from which the field name is required
Returns:
The field name corresponding to the setter

extractClassNameFromParameterisedTypeInField

public static String extractClassNameFromParameterisedTypeInField(Type type)
Given a Type object, it extracts and returns the class name

If a Type was extracted from a Field object, it has the form: class <classname>, e.g. class java.lang.String. This method returns the java.lang.String part of the Type

Parameters:
type - The type from which the class name must be extracted
Returns:
The class part of the Type format

Jemos 2002 - 2011: All Rights Reserved. Podam runs under the MIT license

Copyright © 2011. All Rights Reserved.