public class IBeanTypeMetaInfo<T> extends Object
This class is created once via constructor and is then immutable afterwards.
| Constructor and Description |
|---|
IBeanTypeMetaInfo(Class<T> beanType,
BeanStyle beanStyle,
List<IBeanFieldMetaInfo> fieldMetaInfos,
Method customEqualsMethod,
Method customHashCodeMethod)
Creates a new
IBeanTypeMetaInfo with all contained information. |
| Modifier and Type | Method and Description |
|---|---|
BeanStyle |
beanStyle()
Gives the bean style the bean type complies to.
|
Class<T> |
beanType()
Gives the related bean type.
|
Optional<Method> |
customEqualsMethod()
Provides a method containing custom implementation of
Object.equals(). |
Optional<Method> |
customHashCodeMethod()
Provides a method containing custom implementation of
Object.hashCode(). |
boolean |
equals(Object obj)
Compares this instance with any other object preferably with another
IBeanTypeMetaInfo. |
List<IBeanFieldMetaInfo> |
fieldMetaInfos()
Provides
IBeanFieldMetaInfo for all fields of the bean type. |
Optional<IBeanFieldMetaInfo> |
findFieldMetaWithFieldName(String fieldName)
Iterates over all contained
IBeanFieldMetaInfo and returns the
field meta info that belongs to a field with a given name. |
Optional<IBeanFieldMetaInfo> |
findFieldMetaWithMethod(Method method)
Iterates over all contained
IBeanFieldMetaInfo and returns the
field meta info that contains the given method either as setter or as
getter. |
int |
hashCode() |
int |
noOfFields()
Convenience method returning the number of fields contained in the bean
type.
|
String |
toString() |
public IBeanTypeMetaInfo(Class<T> beanType, BeanStyle beanStyle, List<IBeanFieldMetaInfo> fieldMetaInfos, Method customEqualsMethod, Method customHashCodeMethod)
IBeanTypeMetaInfo with all contained information.beanType - the IBean type the meta information is related tobeanStyle - the bean style that was used for parsing the bean typefieldMetaInfos - meta information about all fields contained in the bean type;
may not be null but may be an empty listcustomEqualsMethod - a Method that contains a bean type individual
implementation of Object.equals(); may be
nullcustomHashCodeMethod - a Method that contains a bean type individual
implementation of Object.hashCode(); may be
nullpublic Class<T> beanType()
public BeanStyle beanStyle()
BeanStyle that was used for parsing the bean typepublic List<IBeanFieldMetaInfo> fieldMetaInfos()
IBeanFieldMetaInfo for all fields of the bean type.public Optional<Method> customEqualsMethod()
Object.equals(). The method is named _equals by
convention.public Optional<Method> customHashCodeMethod()
Object.hashCode(). The method is named _hashCode by
convention.public int noOfFields()
this.fieldMetaInfos.size()public Optional<IBeanFieldMetaInfo> findFieldMetaWithMethod(Method method)
IBeanFieldMetaInfo and returns the
field meta info that contains the given method either as setter or as
getter.method - the getter or setter to search forOptional if no field info
matchespublic Optional<IBeanFieldMetaInfo> findFieldMetaWithFieldName(String fieldName)
IBeanFieldMetaInfo and returns the
field meta info that belongs to a field with a given name.fieldName - the name of a field to search forOptional if no field name
matchespublic boolean equals(Object obj)
IBeanTypeMetaInfo. Two IBeanTypeMetaInfo are equal if
they have the same bean type and the same bean style.equals in class ObjectObject.equals(java.lang.Object)