Package org.nuxeo.ecm.core.storage
Class StateHelper
java.lang.Object
org.nuxeo.ecm.core.storage.StateHelper
Helpers for deep copy and deep diff of
State objects.-
Method Summary
Modifier and TypeMethodDescriptionstatic SerializableMakes a deep copy of a value.static SerializableMakes a deep copy of a value, optionally thread-safe.static List<Serializable> deepCopy(List<Serializable> list) Makes a deep copy of aList.static List<Serializable> deepCopy(List<Serializable> list, boolean threadSafe) Makes a deep copy of aList, optionally thread-safe.static StateMakes a deep copy of aStatemap.static StateMakes a deep copy of aStatemap, optionally thread-safe.static Serializablestatic SerializableDoes a diff of two values.static Serializablestatic State.StateDiffMakes a diff copy of twoStatemaps.static booleanequalsLoose(Object[] a, Object[] b) Compares two arrays of scalars.static booleanequalsLoose(Object a, Object b) Compares two values.static booleanequalsLoose(List<Serializable> a, List<Serializable> b) Compares twoLists.static booleanequalsLoose(State a, State b) Compares twoStates.static booleanequalsStrict(Object[] a, Object[] b) Compares two arrays of scalars.static booleanequalsStrict(Object a, Object b) Compares two values.static booleanequalsStrict(List<Serializable> a, List<Serializable> b) Compares twoLists.static booleanequalsStrict(State a, State b) Compares twoStates.static booleanChecks if we have a base type compatible withStatehelper processing.static voidresetDeltas(State state) Changes the deltas stored into actual full values.static SerializablerpushOrValue(Serializable value) Returns a pure rpush ListDiff for the value if it's an array/list.
-
Method Details
-
isScalar
Checks if we have a base type compatible withStatehelper processing. -
equalsStrict
Compares two values. -
equalsStrict
Compares twoStates. -
equalsStrict
Compares two arrays of scalars. -
equalsStrict
Compares twoLists. -
equalsLoose
-
equalsLoose
-
equalsLoose
Compares two arrays of scalars.nullvalues are equivalent to empty arrays. -
equalsLoose
Compares twoLists.nullvalues are equivalent to empty lists. -
deepCopy
Makes a deep copy of a value. -
deepCopy
Makes a deep copy of a value, optionally thread-safe.- Parameters:
threadSafe- iftrue, then thread-safe datastructures are used
-
deepCopy
Makes a deep copy of aStatemap. -
deepCopy
Makes a deep copy of aStatemap, optionally thread-safe.- Parameters:
threadSafe- iftrue, then thread-safe datastructures are used
-
deepCopy
Makes a deep copy of aList. -
deepCopy
Makes a deep copy of aList, optionally thread-safe.- Parameters:
threadSafe- iftrue, then thread-safe datastructures are used
-
diff
Does a diff of two values.- Returns:
- a
State.StateDiff, aState.ListDiff,State.NOP, or an actual value (includingnull)
-
diff
-
diff
-
findPull
- Since:
- 11.5
-
diff
Makes a diff copy of twoStatemaps.The returned diff state contains only the key/values that changed.
nullvalues are equivalent to absent values.For values set to null or removed, the value is null.
When setting a delta, the old value is checked to know if the delta should be kept or if a full value should be set instead.
For sub-documents, a recursive diff is returned.
- Returns:
- a
State.StateDiffwhich, when applied to a, gives b.
-
rpushOrValue
Returns a pure rpush ListDiff for the value if it's an array/list.- Parameters:
value- the value- Returns:
- a pure rpush ListDiff for the value, if possible
- Since:
- 11.4
-
resetDeltas
Changes the deltas stored into actual full values.- Since:
- 6.0
-