Class EqualsBean


  • public class EqualsBean
    extends Object
    Provides deep Bean equals() and hashCode() functionality for Java Beans.

    It works on all read/write properties, recursively. It support all primitive types, Strings, Collections, bean-like objects and multi-dimensional arrays of any of them.

    The hashcode is calculated by getting the hashcode of the Bean String representation.

    • Method Detail

      • beanEquals

        public static boolean beanEquals​(Class<?> beanClass,
                                         Object obj1,
                                         Object obj2)
        Indicates whether some other object is "equal to" the object passed in the constructor, as defined by the Object equals() method.

        To be used by classes using EqualsBean in a delegation pattern,

        Parameters:
        obj1 - The reference object with which to compare.
        obj2 - The object to which to compare.
        Returns:
        true if the object passed in the constructor is equal to the 'obj' object.
      • beanHashCode

        public static int beanHashCode​(Object obj)
        Returns the hashcode for the object passed in the constructor.

        It follows the contract defined by the Object hashCode() method.

        The hashcode is calculated by getting the hashcode of the Bean String representation.

        To be used by classes using EqualsBean in a delegation pattern,

        Returns:
        the hashcode of the bean object.