org.test4j.datafilling.common
类 ClassFieldInfo

java.lang.Object
  继承者 org.test4j.datafilling.common.ClassFieldInfo
所有已实现的接口:
Serializable

public class ClassFieldInfo
extends Object
implements Serializable

This class wraps fields and setters information about a given class

The purpose of this class is to work as a sort of cache which stores the list of declared fields and setter methods of a given class. These information will then be analysed to compose the list of setters which can be invoked to create the state of a given POJO.

另请参见:
序列化表格

构造方法摘要
ClassFieldInfo(Set<String> classFields, Set<Method> classSetters)
          Full constructor
 
方法摘要
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.
 Set<String> getClassFields()
           
static ClassFieldInfo getClassInfo(Class<?> clazz)
          It returns a ClassFieldInfo object for the given class
 Set<Method> getClassSetters()
           
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 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.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ClassFieldInfo

public ClassFieldInfo(Set<String> classFields,
                      Set<Method> classSetters)
Full constructor

参数:
className - The class name
classFields - The set of fields belonging to this class
classSetters - The set of setters belonging to this class
方法详细信息

getClassSetters

public Set<Method> getClassSetters()
返回:
the classSetters

getClassFields

public Set<String> getClassFields()

getClassInfo

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

参数:
clazz - The class to retrieve info from
返回:
a ClassFieldInfo 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.

参数:
clazz - The class to analyse to retrieve declared fields
返回:
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.

参数:
clazz - The class to analyse for setters
classFields - A Set of field names for which setters are to be found
返回:
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.

参数:
method - The setter method from which the field name is required
返回:
The field name corresponding to the setter


Copyright © 2013. All rights reserved.