Interface EquivalenceStrategy
-
- All Known Implementing Classes:
MidpointProvenanceEquivalenceStrategy
,ParameterizedEquivalenceStrategy
public interface EquivalenceStrategy
A strategy used to determine equivalence of prism items and values. This is quite generic interface. We expect that usually it will not be implemented directly, because comparing prism structures is a complex undertaking. The usual approach will be using ParameterizedEquivalenceStrategy that contains a set of parameters that drive equals/hashCode methods built into prism structures. However, if anyone would need the ultimate flexibility, he is free to implement this interface from scratch. (Note that not all methods in prism API accept this generic form of equivalence strategy. For example, diff(..) methods are limited to ParameterizedEquivalenceStrategy at least for now.)
-
-
Field Summary
Fields Modifier and Type Field Description static ParameterizedEquivalenceStrategy
DATA
Captures the data.static ParameterizedEquivalenceStrategy
IGNORE_METADATA
This is something betweenDATA
andREAL_VALUE
: ignores operational items and values, container IDs, value metadata (just like REAL_VALUE) but takes reference filters and reference resolution options (time, integrity), as well as item names into account (like DATA).static ParameterizedEquivalenceStrategy
LITERAL
Currently the highest level of recognition.static ParameterizedEquivalenceStrategy
NOT_LITERAL
Deprecated.static ParameterizedEquivalenceStrategy
REAL_VALUE
Captures the "real value" of the data: it is something that we consider equivalent so that if prism values A and B have the same real value, we do not want to be both present in the same multi-valued item (like assignment, roleMembershipRef, or whatever).static ParameterizedEquivalenceStrategy
REAL_VALUE_CONSIDER_DIFFERENT_IDS
AsREAL_VALUE
but taking different PCV IDs into account (if both are present).
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
equals(Item<?,?> first, Item<?,?> second)
boolean
equals(PrismValue first, PrismValue second)
int
hashCode(Item<?,?> item)
int
hashCode(PrismValue value)
default <V extends PrismValue>
Comparator<V>prismValueComparator()
-
-
-
Field Detail
-
LITERAL
static final ParameterizedEquivalenceStrategy LITERAL
Currently the highest level of recognition. Roughly corresponds to comparing serialized forms of the data. Useful e.g. for comparing values for the purpose of XML editing. Ignores aspects that are not covered by serialization e.g. definitions, parent objects, origin, immutability flag, etc.
-
DATA
static final ParameterizedEquivalenceStrategy DATA
Captures the data. Ignores minor serialization-related things that are not relevant for the parsed data, like namespace prefixes. Also ignores the difference between null and default relation. Currently this is the default for equals/hashCode.
-
REAL_VALUE
static final ParameterizedEquivalenceStrategy REAL_VALUE
Captures the "real value" of the data: it is something that we consider equivalent so that if prism values A and B have the same real value, we do not want to be both present in the same multi-valued item (like assignment, roleMembershipRef, or whatever). However, in reality, we usually take container IDs (if both are present) into account, so if PCV A1 and A2 have equal content but different IDs they are treated as different. This is reflected inREAL_VALUE_CONSIDER_DIFFERENT_IDS
strategy.
-
REAL_VALUE_CONSIDER_DIFFERENT_IDS
static final ParameterizedEquivalenceStrategy REAL_VALUE_CONSIDER_DIFFERENT_IDS
AsREAL_VALUE
but taking different PCV IDs into account (if both are present). Currently this is the default for delta application. SeeParameterizedEquivalenceStrategy.FOR_DELTA_ADD_APPLICATION
andParameterizedEquivalenceStrategy.FOR_DELTA_DELETE_APPLICATION
. It is not quite clear if this strategy is well-formed. Often we want to differentiate PCV IDs but only on some levels, e.g. for assignments, but not on others, e.g. inside assignments. This has to be sorted out.
-
IGNORE_METADATA
static final ParameterizedEquivalenceStrategy IGNORE_METADATA
This is something betweenDATA
andREAL_VALUE
: ignores operational items and values, container IDs, value metadata (just like REAL_VALUE) but takes reference filters and reference resolution options (time, integrity), as well as item names into account (like DATA). It is not quite clear whether and when to use this strategy.
-
NOT_LITERAL
@Deprecated static final ParameterizedEquivalenceStrategy NOT_LITERAL
Deprecated.
-
-
Method Detail
-
equals
boolean equals(PrismValue first, PrismValue second)
-
hashCode
int hashCode(Item<?,?> item)
-
hashCode
int hashCode(PrismValue value)
-
prismValueComparator
default <V extends PrismValue> Comparator<V> prismValueComparator()
-
-