Class ListFieldReplace<T,E>

Type Parameters:
T - the type of the object containing the changed field
E - the type of the changed list's elements

public class ListFieldReplace<T,E> extends ListFieldChange<T>
Notification object that gets passed to @OnChange-annotated methods when an element is replaced in a list field.
  • Constructor Details

    • ListFieldReplace

      public ListFieldReplace(T jobj, String fieldName, int index, E oldValue, E newValue)
      Constructor.
      Parameters:
      jobj - Java object containing the list field that changed
      fieldName - the name of the field that changed
      index - the index at which the replacement occurred
      oldValue - the old value in the list
      newValue - the new value in the list
      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
    • getIndex

      public int getIndex()
      Get the list index at which the element was replaced.
      Returns:
      the index at which the value was replaced
    • getOldValue

      public E getOldValue()
      Get the value of the field before the change.
      Returns:
      the replaced value
    • getNewValue

      public E getNewValue()
      Get the value of the field 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