Class IBeanTypeMetaInfo<T>


  • public class IBeanTypeMetaInfo<T>
    extends Object
    Class that holds all IBean relevant meta information about a specific bean type, mainly a list of all contained fields.

    This class is created once via constructor and is then immutable afterwards.

    • Constructor Detail

      • IBeanTypeMetaInfo

        public IBeanTypeMetaInfo​(Class<T> beanType,
                                 BeanStyle beanStyle,
                                 List<IBeanFieldMetaInfo> fieldMetaInfos,
                                 Method customEqualsMethod,
                                 Method customHashCodeMethod)
        Creates a new IBeanTypeMetaInfo with all contained information.
        Parameters:
        beanType - the IBean type the meta information is related to
        beanStyle - the bean style that was used for parsing the bean type
        fieldMetaInfos - meta information about all fields contained in the bean type; may not be null but may be an empty list
        customEqualsMethod - a Method that contains a bean type individual implementation of Object.equals(); may be null
        customHashCodeMethod - a Method that contains a bean type individual implementation of Object.hashCode(); may be null
    • Method Detail

      • beanType

        public Class<T> beanType()
        Gives the related bean type.
        Returns:
        the bean class this meta information is related to
      • beanStyle

        public BeanStyle beanStyle()
        Gives the bean style the bean type complies to.
        Returns:
        the BeanStyle that was used for parsing the bean type
      • fieldMetaInfos

        public List<IBeanFieldMetaInfo> fieldMetaInfos()
        Provides IBeanFieldMetaInfo for all fields of the bean type.
        Returns:
        the meta information about all contained fields of the bean type
      • customEqualsMethod

        public Optional<Method> customEqualsMethod()
        Provides a method containing custom implementation of Object.equals(). The method is named _equals by convention.
        Returns:
        the optional method
      • customHashCodeMethod

        public Optional<Method> customHashCodeMethod()
        Provides a method containing custom implementation of Object.hashCode(). The method is named _hashCode by convention.
        Returns:
        the optional method
      • noOfFields

        public int noOfFields()
        Convenience method returning the number of fields contained in the bean type.
        Returns:
        same as this.fieldMetaInfos.size()
      • findFieldMetaWithMethod

        public 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.
        Parameters:
        method - the getter or setter to search for
        Returns:
        the field meta info or an empty Optional if no field info matches
      • findFieldMetaWithFieldName

        public 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.
        Parameters:
        fieldName - the name of a field to search for
        Returns:
        the field meta info or an empty Optional if no field name matches
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object obj)
        Compares this instance with any other object preferably with another IBeanTypeMetaInfo. Two IBeanTypeMetaInfo are equal if they have the same bean type and the same bean style.
        Overrides:
        equals in class Object
        See Also:
        Object.equals(java.lang.Object)