Package io.permazen.change
Class ListFieldReplace<T,E>
java.lang.Object
io.permazen.change.Change<T>
io.permazen.change.FieldChange<T>
io.permazen.change.ListFieldChange<T>
io.permazen.change.ListFieldReplace<T,E>
- Type Parameters:
T
- the type of the object containing the changed fieldE
- the type of the changed list's elements
Notification object that gets passed to
@OnChange
-annotated methods
when an element is replaced in a list field.-
Constructor Summary
ConstructorDescriptionListFieldReplace
(T jobj, String fieldName, int index, E oldValue, E newValue) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(PermazenTransaction jtx, PermazenObject jobj) Apply this change to the given object in the given transaction.boolean
int
getIndex()
Get the list index at which the element was replaced.Get the value of the field after the change.Get the value of the field before the change.int
hashCode()
toString()
<R> R
visit
(ChangeSwitch<R> target) Apply visitor pattern.Methods inherited from class io.permazen.change.FieldChange
getFieldName
-
Constructor Details
-
ListFieldReplace
Constructor.- Parameters:
jobj
- Java object containing the list field that changedfieldName
- the name of the field that changedindex
- the index at which the replacement occurredoldValue
- the old value in the listnewValue
- the new value in the list- Throws:
IllegalArgumentException
- ifjobj
orfieldName
is null
-
-
Method Details
-
visit
Description copied from class:Change
Apply visitor pattern. Invokes the method oftarget
corresponding to this instance's type. -
apply
Description copied from class:Change
Apply this change to the given object in the given transaction. -
getIndex
public int getIndex()Get the list index at which the element was replaced.- Returns:
- the index at which the value was replaced
-
getOldValue
Get the value of the field before the change.- Returns:
- the replaced value
-
getNewValue
Get the value of the field after the change.- Returns:
- the replacing value
-
equals
- Overrides:
equals
in classFieldChange<T>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classFieldChange<T>
-
toString
-