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 Serializable
Makes a deep copy of a value.static Serializable
Makes 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 State
Makes a deep copy of aState
map.static State
Makes a deep copy of aState
map, optionally thread-safe.static Serializable
static Serializable
Does a diff of two values.static Serializable
static State.StateDiff
Makes a diff copy of twoState
maps.static boolean
equalsLoose
(Object[] a, Object[] b) Compares two arrays of scalars.static boolean
equalsLoose
(Object a, Object b) Compares two values.static boolean
equalsLoose
(List<Serializable> a, List<Serializable> b) Compares twoList
s.static boolean
equalsLoose
(State a, State b) Compares twoState
s.static boolean
equalsStrict
(Object[] a, Object[] b) Compares two arrays of scalars.static boolean
equalsStrict
(Object a, Object b) Compares two values.static boolean
equalsStrict
(List<Serializable> a, List<Serializable> b) Compares twoList
s.static boolean
equalsStrict
(State a, State b) Compares twoState
s.static boolean
Checks if we have a base type compatible withState
helper processing.static void
resetDeltas
(State state) Changes the deltas stored into actual full values.static Serializable
rpushOrValue
(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 withState
helper processing. -
equalsStrict
Compares two values. -
equalsStrict
Compares twoState
s. -
equalsStrict
Compares two arrays of scalars. -
equalsStrict
Compares twoList
s. -
equalsLoose
-
equalsLoose
-
equalsLoose
Compares two arrays of scalars.null
values are equivalent to empty arrays. -
equalsLoose
Compares twoList
s.null
values 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 aState
map. -
deepCopy
Makes a deep copy of aState
map, 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 twoState
maps.The returned diff state contains only the key/values that changed.
null
values 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.StateDiff
which, 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
-