Class CompareAndMergeUtils


  • public class CompareAndMergeUtils
    extends java.lang.Object
    Contains utils in the context of compare and merge features
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean DEBUG  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double getDistance​(PamelaModelFactory factory, java.lang.Object o1, java.lang.Object o2)
      Compute the distance (double value between 0.0 and 1.0) between this object and an opposite object (which must be of right type!) If two objects are equals, return 0.
      static <I> double getDistance​(ProxyMethodHandler<I> source, java.lang.Object obj)
      Compute the distance (double value between 0.0 and 1.0) between this object and an opposite object (which must be of right type!) If two objects are equals, return 0.
      protected static boolean isEqual​(java.lang.Object oldValue, java.lang.Object newValue)  
      static <I> boolean updateWith​(ProxyMethodHandler<I> source, I obj)
      Called to update source object while comparing it to opposite object, (which must be of right type!), examining each property values.
      Collections are handled while trying to match updated objects with a given strategy
      Perform required changes on this object so that at the end of the call, equalsObject(object) shoud return true
      Also perform required notifications, so that it is safe to call that method in a deployed environment
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEBUG

        public static boolean DEBUG
    • Constructor Detail

      • CompareAndMergeUtils

        public CompareAndMergeUtils()
    • Method Detail

      • updateWith

        public static <I> boolean updateWith​(ProxyMethodHandler<I> source,
                                             I obj)
        Called to update source object while comparing it to opposite object, (which must be of right type!), examining each property values.
        Collections are handled while trying to match updated objects with a given strategy
        Perform required changes on this object so that at the end of the call, equalsObject(object) shoud return true
        Also perform required notifications, so that it is safe to call that method in a deployed environment
        Type Parameters:
        I - type of object beeing handled
        Parameters:
        obj - object to update with, which must be of same type
        Returns:
        boolean indicating if update was successfull
      • getDistance

        public static double getDistance​(PamelaModelFactory factory,
                                         java.lang.Object o1,
                                         java.lang.Object o2)
        Compute the distance (double value between 0.0 and 1.0) between this object and an opposite object (which must be of right type!) If two objects are equals, return 0. If two objects are totally different, return 1.
        Parameters:
        factory -
        o1 -
        o2 -
        Returns:
      • getDistance

        public static <I> double getDistance​(ProxyMethodHandler<I> source,
                                             java.lang.Object obj)
        Compute the distance (double value between 0.0 and 1.0) between this object and an opposite object (which must be of right type!) If two objects are equals, return 0. If two objects are totally different, return 1.
        Parameters:
        object -
        Returns:
      • isEqual

        protected static boolean isEqual​(java.lang.Object oldValue,
                                         java.lang.Object newValue)