Package com.evolveum.midpoint.prism.impl
Class PrismValueImpl
- java.lang.Object
-
- com.evolveum.midpoint.prism.AbstractFreezable
-
- com.evolveum.midpoint.prism.impl.PrismValueImpl
-
- All Implemented Interfaces:
Freezable
,MidpointOriginMetadata
,PathVisitable
,PrismContextSensitive
,PrismValue
,Revivable
,Visitable
,DebugDumpable
,Serializable
- Direct Known Subclasses:
PrismContainerValueImpl
,PrismPropertyValueImpl
,PrismReferenceValueImpl
public abstract class PrismValueImpl extends AbstractFreezable implements PrismValue
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected EquivalenceStrategy
defaultEquivalenceStrategy
protected PrismContext
prismContext
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
void
accept(Visitor visitor, ItemPath path, boolean recursive)
protected void
appendOriginDump(StringBuilder builder)
void
applyDefinition(ItemDefinition definition)
void
applyDefinition(ItemDefinition definition, boolean force)
abstract void
checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
void
clearParent()
Used when we are removing the value from the previous parent.abstract PrismValue
clone()
Literal clone.abstract PrismValue
cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.protected void
copyValues(CloneStrategy strategy, PrismValueImpl clone)
PrismValue
createImmutableClone()
Collection<? extends ItemDelta>
diff(PrismValue otherValue)
Assumes matching representations.Collection<? extends ItemDelta>
diff(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy)
Assumes matching representations.void
diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy)
boolean
equals(PrismValue otherValue, @NotNull EquivalenceStrategy equivalenceStrategy)
boolean
equals(PrismValue other, @NotNull ParameterizedEquivalenceStrategy strategy)
boolean
equals(PrismValue thisValue, PrismValue otherValue)
boolean
equals(Object other)
@NotNull Collection<PrismValue>
getAllValues(ItemPath path)
protected ItemDefinition
getDefinition()
protected EquivalenceStrategy
getEqualsHashCodeStrategy()
Objectable
getOriginObject()
OriginType
getOriginType()
Itemable
getParent()
PrismContainerValue<?>
getParentContainerValue()
@NotNull ItemPath
getPath()
protected Object
getPathComponent()
PrismContext
getPrismContext()
abstract @Nullable Class<?>
getRealClass()
abstract <T> T
getRealValue()
PrismValue
getRootValue()
QName
getTypeName()
Map<String,Object>
getUserData()
Object
getUserData(@NotNull String key)
int
hashCode()
int
hashCode(@NotNull EquivalenceStrategy equivalenceStrategy)
int
hashCode(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
void
normalize()
void
recompute()
Recompute the value or otherwise "initialize" it before adding it to a prism tree.abstract void
recompute(PrismContext prismContext)
boolean
representsSameValue(PrismValue other, boolean lax)
Returns true if this and other value represent the same value.void
revive(PrismContext prismContext)
void
setOriginObject(Objectable source)
void
setOriginType(OriginType type)
void
setParent(Itemable parent)
void
setPrismContext(PrismContext prismContext)
void
setUserData(@NotNull String key, Object value)
abstract String
toHumanReadableString()
-
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, isImmutable, isMutable, performFreeze
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.Freezable
checkImmutable, checkMutable, freeze, isImmutable
-
Methods inherited from interface com.evolveum.midpoint.prism.PrismValue
find, getRealValueOrRawType, hasRealClass, isEmpty, isRaw
-
-
-
-
Field Detail
-
defaultEquivalenceStrategy
protected EquivalenceStrategy defaultEquivalenceStrategy
-
prismContext
protected transient PrismContext prismContext
-
-
Method Detail
-
setPrismContext
public void setPrismContext(PrismContext prismContext)
- Specified by:
setPrismContext
in interfacePrismValue
-
setOriginObject
public void setOriginObject(Objectable source)
- Specified by:
setOriginObject
in interfaceMidpointOriginMetadata
-
setOriginType
public void setOriginType(OriginType type)
- Specified by:
setOriginType
in interfaceMidpointOriginMetadata
-
getOriginType
public OriginType getOriginType()
- Specified by:
getOriginType
in interfaceMidpointOriginMetadata
-
getOriginObject
public Objectable getOriginObject()
- Specified by:
getOriginObject
in interfaceMidpointOriginMetadata
-
getUserData
public Map<String,Object> getUserData()
- Specified by:
getUserData
in interfacePrismValue
-
getUserData
public Object getUserData(@NotNull @NotNull String key)
- Specified by:
getUserData
in interfacePrismValue
-
setUserData
public void setUserData(@NotNull @NotNull String key, Object value)
- Specified by:
setUserData
in interfacePrismValue
-
getParent
public Itemable getParent()
- Specified by:
getParent
in interfacePrismValue
-
setParent
public void setParent(Itemable parent)
- Specified by:
setParent
in interfacePrismValue
-
getPath
@NotNull public @NotNull ItemPath getPath()
- Specified by:
getPath
in interfacePrismValue
-
getPathComponent
protected Object getPathComponent()
-
clearParent
public void clearParent()
Used when we are removing the value from the previous parent. Or when we know that the previous parent will be discarded and we want to avoid unnecessary cloning.- Specified by:
clearParent
in interfacePrismValue
-
getPrismContext
public PrismContext getPrismContext()
- Specified by:
getPrismContext
in interfacePrismContextSensitive
-
getDefinition
protected ItemDefinition getDefinition()
-
applyDefinition
public void applyDefinition(ItemDefinition definition) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismValue
- Throws:
SchemaException
-
applyDefinition
public void applyDefinition(ItemDefinition definition, boolean force) throws SchemaException
- Specified by:
applyDefinition
in interfacePrismValue
- Throws:
SchemaException
-
revive
public void revive(PrismContext prismContext) throws SchemaException
- Specified by:
revive
in interfaceRevivable
- Throws:
SchemaException
-
recompute
public void recompute()
Recompute the value or otherwise "initialize" it before adding it to a prism tree. This may as well do nothing if no recomputing or initialization is needed.- Specified by:
recompute
in interfacePrismValue
-
recompute
public abstract void recompute(PrismContext prismContext)
- Specified by:
recompute
in interfacePrismValue
-
accept
public void accept(Visitor visitor)
- Specified by:
accept
in interfacePrismValue
- Specified by:
accept
in interfaceVisitable
-
accept
public void accept(Visitor visitor, ItemPath path, boolean recursive)
- Specified by:
accept
in interfacePathVisitable
- Specified by:
accept
in interfacePrismValue
-
checkConsistenceInternal
public abstract void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope)
- Specified by:
checkConsistenceInternal
in interfacePrismValue
-
representsSameValue
public boolean representsSameValue(PrismValue other, boolean lax)
Description copied from interface:PrismValue
Returns true if this and other value represent the same value. E.g. if they have the same IDs, OIDs or it is otherwise know that they "belong together" without a deep examination of the values.- Specified by:
representsSameValue
in interfacePrismValue
lax
- If we can reasonably assume that the two values belong together even if they don't have the same ID, e.g. if they both belong to single-valued parent items. This is useful e.g. when comparing multi-valued containers. But can cause problems when we want to be sure we are removing the correct value.
-
normalize
public void normalize()
- Specified by:
normalize
in interfacePrismValue
-
clone
public abstract PrismValue clone()
Literal clone.- Specified by:
clone
in interfacePrismValue
- Overrides:
clone
in classObject
-
createImmutableClone
public PrismValue createImmutableClone()
- Specified by:
createImmutableClone
in interfacePrismValue
-
cloneComplex
public abstract PrismValue cloneComplex(CloneStrategy strategy)
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfacePrismValue
- See Also:
CloneStrategy
-
copyValues
protected void copyValues(CloneStrategy strategy, PrismValueImpl clone)
-
getEqualsHashCodeStrategy
protected EquivalenceStrategy getEqualsHashCodeStrategy()
-
hashCode
public int hashCode(@NotNull @NotNull ParameterizedEquivalenceStrategy equivalenceStrategy)
- Specified by:
hashCode
in interfacePrismValue
-
hashCode
public int hashCode(@NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
- Specified by:
hashCode
in interfacePrismValue
-
equals
public boolean equals(PrismValue otherValue, @NotNull @NotNull EquivalenceStrategy equivalenceStrategy)
- Specified by:
equals
in interfacePrismValue
-
equals
public boolean equals(PrismValue other, @NotNull @NotNull ParameterizedEquivalenceStrategy strategy)
- Specified by:
equals
in interfacePrismValue
-
equals
public boolean equals(PrismValue thisValue, PrismValue otherValue)
- Specified by:
equals
in interfacePrismValue
-
diff
public Collection<? extends ItemDelta> diff(PrismValue otherValue)
Assumes matching representations. I.e. it assumes that both this and otherValue represent the same instance of item. E.g. the container with the same ID.- Specified by:
diff
in interfacePrismValue
-
diff
public Collection<? extends ItemDelta> diff(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy)
Assumes matching representations. I.e. it assumes that both this and otherValue represent the same instance of item. E.g. the container with the same ID.- Specified by:
diff
in interfacePrismValue
-
diffMatchingRepresentation
public void diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy)
-
appendOriginDump
protected void appendOriginDump(StringBuilder builder)
-
toHumanReadableString
public abstract String toHumanReadableString()
- Specified by:
toHumanReadableString
in interfacePrismValue
-
getRealClass
@Nullable public abstract @Nullable Class<?> getRealClass()
- Specified by:
getRealClass
in interfacePrismValue
-
getRealValue
@Nullable public abstract <T> T getRealValue()
- Specified by:
getRealValue
in interfacePrismValue
-
getRootValue
public PrismValue getRootValue()
- Specified by:
getRootValue
in interfacePrismValue
-
getParentContainerValue
public PrismContainerValue<?> getParentContainerValue()
- Specified by:
getParentContainerValue
in interfacePrismValue
-
getTypeName
public QName getTypeName()
- Specified by:
getTypeName
in interfacePrismValue
-
getAllValues
@NotNull public @NotNull Collection<PrismValue> getAllValues(ItemPath path)
- Specified by:
getAllValues
in interfacePrismValue
-
-