Class BeanUtils


  • public class BeanUtils
    extends Object
    Utilities for beans.

    Created by Jeff Gaynor
    on May 26, 2011 at 10:16:20 AM

    • Constructor Detail

      • BeanUtils

        public BeanUtils()
    • Method Detail

      • checkEquals

        public static boolean checkEquals​(Object x,
                                          Object y)
        This checks if two objects are equal. This uses the object's equals method to check, so if the object allows for nulls then this will pass. Some objects that have no content allow equality to null objects.
        Parameters:
        x -
        y -
        Returns:
      • checkNoNulls

        public static boolean checkNoNulls​(Object x,
                                           Object y)
        This presupposes that nulls are not permitted, so if one of the objects is null, it cannot possible be equal to the other, e.g. comparing URIs.
        Parameters:
        x -
        y -
        Returns:
      • checkBasic

        public static boolean checkBasic​(Object obj1,
                                         Object obj2)
        Very basic checks that all objects should do as part of their equals methods. Checks null-ity of the an object and if the second is an instance of the first.
         public boolean equals(fnord){
         if(!BeanUtils.checkBasic(this, fnord)) return false;
         // Rock on feel free to cast too
         }
         
        Parameters:
        obj1 -
        obj2 -
        Returns: