Class DifferenceMap

java.lang.Object
com.webmethods.rtl.util.obj.DifferenceMap
All Implemented Interfaces:
Serializable

public class DifferenceMap extends Object implements Serializable
Storage to store/obtain instances of the DifferenceEntry objects. Difference map is used when you need to take some actions when something changed in the system. Difference map allows to describe any types of changes using simple map-based storage mechanism
 DifferenceMap diffMap = new DifferenceMap();
 diffMap.put("property", "old value", "new value");

 ....

 DifferenceEntry diffEntry = diffMap.get("property);

 // do some logic with difference entry
 if (diffEntry.getOldValue() ...) {
 }

 
See Also:
  • Field Details

    • lineSeparator

      public static final String lineSeparator
  • Constructor Details

    • DifferenceMap

      public DifferenceMap()
      Create difference entries storage
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Remove unused outside references
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • clear

      public void clear()
      Removes all inserted difference entries
    • size

      public int size()
      Returns current quantity of difference entries inside the container
    • isEmpty

      public boolean isEmpty()
      Returns true if container is empty
    • iterator

      public Iterator<DifferenceEntry> iterator()
      Returns iterator to all values inside difference storage
      Returns:
      Iterator of DifferenceEntry objects
    • put

      public void put(String name, Object oldValue, Object newValue)
      Put a new entry with the specified difference values
      Parameters:
      name - Entry name
      oldValue - Old entry value
      newValue - New entry value
    • put

      public void put(DifferenceEntry diffEntry)
      Put an instance of DifferenceEntry to the map
      Parameters:
      diffEntry - Created DifferenceEntry instance
    • putAll

      public void putAll(DifferenceMap map)
      Joins 2 difference maps together
      Parameters:
      map - Difference map to combine
    • get

      public DifferenceEntry get(String name)
      Retrieve specified difference entry by name
      Parameters:
      name - Entry name to retrieve
      Returns:
      Instance of DifferenceEntry or null if no entry corresponds to specified name
    • toString

      public String toString()
      Provides string presentation of the difference map for the debugging purposes
      Overrides:
      toString in class Object
      Returns:
      String presentation of the difference map for debugging purposes
    • setReference

      public void setReference(Serializable reference)
      Set reference instance object (should be Serializable) Allows to specify some object tight to particular difference map
      Parameters:
      reference - Object instance to serve as an additional data to difference map
    • getReference

      public Serializable getReference()
      Get additional object reference tight to difference map
      Returns:
      Object reference if any was assigned