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
,ItemDefinitionTransformer.TransformableValue
,MidpointOriginMetadata
,PathVisitable
,PrismValue
,Revivable
,SchemaLookup.Aware
,Visitable
,DebugDumpable
,Serializable
- Direct Known Subclasses:
PrismContainerValueImpl
,PrismPropertyValueImpl
,PrismReferenceValueImpl
public abstract class PrismValueImpl
extends AbstractFreezable
implements PrismValue, ItemDefinitionTransformer.TransformableValue
- Author:
- semancik
- See Also:
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
protected void
appendOriginDump
(StringBuilder builder) abstract void
checkConsistenceInternal
(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) void
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) Collection<? extends ItemDelta>
diff
(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy) Assumes matching representations.final void
diffMatchingRepresentation
(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy) boolean
diffMatchingRepresentation
(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy, boolean exitOnDiff) boolean
equals
(PrismValue otherValue, @NotNull EquivalenceStrategy equivalenceStrategy) boolean
equals
(PrismValue other, @NotNull ParameterizedEquivalenceStrategy strategy) boolean
@NotNull Collection<Item<?,
?>> getAllItems
(@NotNull ItemPath path) @NotNull Collection<PrismValue>
getAllValues
(ItemPath path) protected ItemDefinition
@NotNull ItemPath
getPath()
protected Object
abstract @Nullable Class<?>
abstract <T> T
Returns the statically-typed "real value".@NotNull PrismValue
getUserData
(@NotNull String key) @NotNull ValueMetadata
Returns the value metadata, creating empty one if there's none.@Nullable ValueMetadata
Returns the value metadata, if there is any.int
hashCode()
int
hashCode
(@NotNull EquivalenceStrategy equivalenceStrategy) int
hashCode
(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy) boolean
boolean
void
Currently doing nothing.protected void
void
Recompute the value or otherwise "initialize" it before adding it to a prism tree.abstract void
recompute
(PrismContext prismContext) boolean
representsSameValue
(PrismValue other, EquivalenceStrategy strategy, boolean lax) Returns true if this and other value represent the same value.void
revive
(PrismContext prismContext) TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)void
setOriginObject
(Objectable source) void
setOriginType
(OriginType type) void
void
setTransient
(boolean value) void
setUserData
(@NotNull String key, Object value) void
setValueMetadata
(Containerable realValue) Sets metadata from this value (from PCV).void
setValueMetadata
(PrismContainer<?> valueMetadataContainer) Sets metadata for this value.void
setValueMetadata
(ValueMetadata valueMetadata) Sets metadata for this value.abstract String
Methods inherited from class com.evolveum.midpoint.prism.AbstractFreezable
freeze, freeze, freezeAll, freezeNullableList, isImmutable, isMutable
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.ItemDefinitionTransformer.TransformableValue
transformDefinition
Methods inherited from interface com.evolveum.midpoint.prism.PrismValue
applyDefinition, applyDefinition, applyDefinitionLegacy, applyDefinitionLegacy, cloneIfImmutable, deleteValueMetadata, find, getNearestValueOfType, getRealValueIfExists, getRealValueOrRawType, getRootObjectable, getValueMetadataAsContainer, hasRealClass, isEmpty, isObjectable, isOfType, isRaw
-
Field Details
-
defaultEquivalenceStrategy
-
-
Method Details
-
setOriginObject
- Specified by:
setOriginObject
in interfaceMidpointOriginMetadata
-
setOriginType
- Specified by:
setOriginType
in interfaceMidpointOriginMetadata
-
getOriginType
- Specified by:
getOriginType
in interfaceMidpointOriginMetadata
-
getOriginObject
- Specified by:
getOriginObject
in interfaceMidpointOriginMetadata
-
getUserData
- Specified by:
getUserData
in interfacePrismValue
-
getUserData
- Specified by:
getUserData
in interfacePrismValue
-
setUserData
- Specified by:
setUserData
in interfacePrismValue
-
getParent
- Specified by:
getParent
in interfacePrismValue
-
setParent
- Specified by:
setParent
in interfacePrismValue
-
getPath
- Specified by:
getPath
in interfacePrismValue
-
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
-
getDefinition
-
revive
Description copied from interface:Revivable
TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary) -
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
- Specified by:
recompute
in interfacePrismValue
-
accept
- Specified by:
accept
in interfacePrismValue
- Specified by:
accept
in interfaceVisitable
-
accept
- 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
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()Description copied from interface:PrismValue
Currently doing nothing.- Specified by:
normalize
in interfacePrismValue
-
clone
Literal clone.- Specified by:
clone
in interfacePrismValue
- Overrides:
clone
in classObject
-
createImmutableClone
- Specified by:
createImmutableClone
in interfacePrismValue
-
cloneComplex
Complex clone with different cloning strategies.- Specified by:
cloneComplex
in interfacePrismValue
- See Also:
-
copyValues
-
hashCode
public int hashCode() -
hashCode
- Specified by:
hashCode
in interfacePrismValue
-
hashCode
- 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
-
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 final void diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy) -
diffMatchingRepresentation
public boolean diffMatchingRepresentation(PrismValue otherValue, Collection<? extends ItemDelta> deltas, ParameterizedEquivalenceStrategy strategy, boolean exitOnDiff) -
appendOriginDump
-
toHumanReadableString
- Specified by:
toHumanReadableString
in interfacePrismValue
-
getRealClass
- Specified by:
getRealClass
in interfacePrismValue
-
getRealValue
@Nullable public abstract <T> T getRealValue()Description copied from interface:PrismValue
Returns the statically-typed "real value". TODO specify when exactly the returned value can be null. TODO decide for containers: they throw an exception if the value is not statically typed.- Specified by:
getRealValue
in interfacePrismValue
-
getRootValue
- Specified by:
getRootValue
in interfacePrismValue
-
getParentContainerValue
- Specified by:
getParentContainerValue
in interfacePrismValue
-
getTypeName
- Specified by:
getTypeName
in interfacePrismValue
-
getAllValues
Description copied from interface:PrismValue
- Specified by:
getAllValues
in interfacePrismValue
-
getAllItems
Description copied from interface:PrismValue
SeeItem.getAllItems(ItemPath)
. Here the path is never empty.- Specified by:
getAllItems
in interfacePrismValue
-
getValueMetadata
Description copied from interface:PrismValue
Returns the value metadata, creating empty one if there's none. When performance is critical, consider usingPrismValue.getValueMetadataIfExists()
instead; or callPrismValue.hasValueMetadata()
first.- Specified by:
getValueMetadata
in interfacePrismValue
-
getValueMetadataIfExists
Description copied from interface:PrismValue
Returns the value metadata, if there is any.- Specified by:
getValueMetadataIfExists
in interfacePrismValue
-
hasValueMetadata
public boolean hasValueMetadata()- Specified by:
hasValueMetadata
in interfacePrismValue
- Returns:
- True if this value has any metadata (i.e. the metadata container has any value). TODO Or should we accept only non-empty values? Probably not.
-
setValueMetadata
Description copied from interface:PrismValue
Sets metadata for this value.- Specified by:
setValueMetadata
in interfacePrismValue
-
setValueMetadata
Description copied from interface:PrismValue
Sets metadata for this value.- Specified by:
setValueMetadata
in interfacePrismValue
-
setValueMetadata
Description copied from interface:PrismValue
Sets metadata from this value (from PCV). To be removed (most probably).- Specified by:
setValueMetadata
in interfacePrismValue
- Throws:
SchemaException
-
performFreeze
protected void performFreeze()- Overrides:
performFreeze
in classAbstractFreezable
-
isTransient
public boolean isTransient()- Specified by:
isTransient
in interfacePrismValue
- Returns:
- True if the value is transient, so it won't be serialized if serialization of transient value is disabled.
-
setTransient
public void setTransient(boolean value) - Specified by:
setTransient
in interfacePrismValue
-
getSchemaContext
- Specified by:
getSchemaContext
in interfacePrismValue
-
schemaLookup
- Specified by:
schemaLookup
in interfacePrismValue
- Specified by:
schemaLookup
in interfaceSchemaLookup.Aware
-