Class MapFieldReplace<T,K,V>

Type Parameters:
T - the type of the object containing the changed field
K - the type of the changed map's key
V - the type of the changed map's value

public class MapFieldReplace<T,K,V> extends MapFieldChange<T>
Notification object that gets passed to @OnChange-annotated methods when the value in a key/value pair is replaced with a new value.
  • Constructor Details

    • MapFieldReplace

      public MapFieldReplace(T jobj, String fieldName, K key, V oldValue, V newValue)
      Constructor.
      Parameters:
      jobj - Java object containing the map field that changed
      fieldName - the name of the field that changed
      key - the key whose value was changed
      oldValue - the old value associated with key
      newValue - the new value associated with key
      Throws:
      IllegalArgumentException - if jobj or fieldName is null
  • Method Details

    • visit

      public <R> R visit(ChangeSwitch<R> target)
      Description copied from class: Change
      Apply visitor pattern. Invokes the method of target corresponding to this instance's type.
      Specified by:
      visit in class Change<T>
      Type Parameters:
      R - visitor return type
      Parameters:
      target - visitor pattern target
      Returns:
      value returned by the selected method of target
    • apply

      public void apply(PermazenTransaction jtx, PermazenObject jobj)
      Description copied from class: Change
      Apply this change to the given object in the given transaction.
      Specified by:
      apply in class Change<T>
      Parameters:
      jtx - the transaction in which to apply this change
      jobj - the target object to which to apply this change
    • getKey

      public K getKey()
      Get the key of the key/value pair whose value was replaced.
      Returns:
      the key of the replaced value
    • getOldValue

      public V getOldValue()
      Get the value of the key/value pair before the change.
      Returns:
      the replaced value
    • getNewValue

      public V getNewValue()
      Get the value of the key/value pair after the change.
      Returns:
      the replacing value
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class FieldChange<T>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class FieldChange<T>
    • toString

      public String toString()
      Overrides:
      toString in class Object