Package com.evolveum.midpoint.prism
Interface PrismValue
- All Superinterfaces:
DebugDumpable
,Freezable
,MidpointOriginMetadata
,PathVisitable
,Revivable
,SchemaLookup.Aware
,Serializable
,Visitable
- All Known Subinterfaces:
PrismContainerValue<C>
,PrismObjectValue<O>
,PrismPropertyValue<T>
,PrismReferenceValue
- All Known Implementing Classes:
PrismContainerValueImpl
,PrismObjectValueImpl
,PrismPropertyValueImpl
,PrismReferenceValueImpl
,PrismValueImpl
,ShadowAssociationValue
,ShadowReferenceAttributeValue
public interface PrismValue
extends Visitable, PathVisitable, Serializable, DebugDumpable, Revivable, Freezable, MidpointOriginMetadata, SchemaLookup.Aware
- Author:
- semancik
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
default PrismValue
applyDefinition
(@NotNull ItemDefinition<?> definition) Definition application MAY change the value (currently only for container values).applyDefinition
(@NotNull ItemDefinition<?> definition, boolean force) Definition application MAY change the value (currently only for container values).default void
applyDefinitionLegacy
(@NotNull ItemDefinition<?> definition) This one checks that nothing has changed.default void
applyDefinitionLegacy
(@NotNull ItemDefinition<?> definition, boolean force) Definition application MAY change the value (currently only for container/reference values).void
checkConsistenceInternal
(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) void
Used when we are removing the value from the previous parent.clone()
Literal clone.cloneComplex
(CloneStrategy strategy) Complex clone with different cloning strategies.default @NotNull PrismValue
default void
Collection<? extends ItemDelta>
diff
(PrismValue otherValue, ParameterizedEquivalenceStrategy strategy) Assumes matching representations.boolean
equals
(PrismValue otherValue, @NotNull EquivalenceStrategy strategy) boolean
equals
(PrismValue otherValue, @NotNull ParameterizedEquivalenceStrategy strategy) @NotNull Collection<Item<?,
?>> getAllItems
(@NotNull ItemPath path) @NotNull Collection<PrismValue>
getAllValues
(ItemPath path) default <T> T
getNearestValueOfType
(@NotNull Class<T> type) @NotNull ItemPath
getPath()
@Nullable Class<?>
<T> T
Returns the statically-typed "real value".default @Nullable Object
default @Nullable Object
default @Nullable Objectable
Returns the top-most object (Objectable
).@NotNull PrismValue
getUserData
(@NotNull String key) @NotNull ValueMetadata
Returns the value metadata, creating empty one if there's none.default <C extends Containerable>
@NotNull PrismContainer<C>Returns value metadata as typed PrismContainer.@Nullable ValueMetadata
Returns the value metadata, if there is any.int
hashCode
(@NotNull EquivalenceStrategy equivalenceStrategy) int
hashCode
(@NotNull ParameterizedEquivalenceStrategy equivalenceStrategy) default boolean
boolean
boolean
isEmpty()
default boolean
Returns `true` if this value represents aPrismObject
value.default boolean
Ignores untyped values (considers them non-matching).boolean
isRaw()
boolean
void
Currently doing nothing.void
Recompute the value or otherwise "initialize" it before adding it to a prism tree.void
recompute
(PrismContext prismContext) boolean
representsSameValue
(PrismValue other, EquivalenceStrategy strategy, boolean lax) Returns true if this and other value represent the same value.default SchemaLookup
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<?> valueMetadata) Sets metadata for this value.void
setValueMetadata
(ValueMetadata valueMetadata) Sets metadata for this value.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.metadata.MidpointOriginMetadata
getOriginObject, getOriginType, setOriginObject, setOriginType
-
Method Details
-
getUserData
-
getUserData
-
setUserData
-
getParent
Itemable getParent() -
setParent
-
getValueMetadata
Returns the value metadata, creating empty one if there's none. When performance is critical, consider usinggetValueMetadataIfExists()
instead; or callhasValueMetadata()
first. -
getValueMetadataIfExists
Returns the value metadata, if there is any. -
getValueMetadataAsContainer
@Experimental @NotNull default <C extends Containerable> @NotNull PrismContainer<C> getValueMetadataAsContainer()Returns value metadata as typed PrismContainer. Useful for lazy clients because of the type matching. -
hasValueMetadata
boolean hasValueMetadata()- 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
Sets metadata for this value. -
setValueMetadata
Sets metadata for this value. -
setValueMetadata
Sets metadata from this value (from PCV). To be removed (most probably).- Throws:
SchemaException
-
deleteValueMetadata
default void deleteValueMetadata() -
getPath
-
clearParent
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. -
applyDefinition
default PrismValue applyDefinition(@NotNull @NotNull ItemDefinition<?> definition) throws SchemaException Definition application MAY change the value (currently only for container values). The caller must deal with that. To be seen if this is a good idea. But probably so, because there are various situations when the definition application changes the nature of a prism value (midPoint shadow associations are currently the only places) but of prism items (midPoint attributes and associations need this; and it must be worked around for now).- Throws:
SchemaException
-
applyDefinitionLegacy
default void applyDefinitionLegacy(@NotNull @NotNull ItemDefinition<?> definition) throws SchemaException This one checks that nothing has changed.- Throws:
SchemaException
-
applyDefinition
PrismValue applyDefinition(@NotNull @NotNull ItemDefinition<?> definition, boolean force) throws SchemaException Definition application MAY change the value (currently only for container values). The caller must deal with that.- Throws:
SchemaException
-
applyDefinitionLegacy
default void applyDefinitionLegacy(@NotNull @NotNull ItemDefinition<?> definition, boolean force) throws SchemaException Definition application MAY change the value (currently only for container/reference values). The caller must deal with that.- Throws:
SchemaException
-
recompute
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. -
recompute
-
accept
-
accept
- Specified by:
accept
in interfacePathVisitable
-
checkConsistenceInternal
void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitions, boolean prohibitRaw, ConsistencyCheckScope scope) -
representsSameValue
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.- Parameters:
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
void normalize()Currently doing nothing. -
clone
PrismValue clone()Literal clone. -
createImmutableClone
PrismValue createImmutableClone() -
cloneComplex
Complex clone with different cloning strategies.- See Also:
-
hashCode
-
hashCode
-
equals
-
equals
-
diff
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. -
getRealClass
-
hasRealClass
-
getRealValue
@Nullable <T> T getRealValue()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. -
getRealValueOrRawType
-
getRealValueIfExists
-
getRootValue
-
getRootObjectable
Returns the top-most object (Objectable
). -
getNearestValueOfType
-
getParentContainerValue
PrismContainerValue<?> getParentContainerValue() -
getTypeName
QName getTypeName() -
getAllValues
-
getAllItems
SeeItem.getAllItems(ItemPath)
. Here the path is never empty. -
isRaw
boolean isRaw() -
isEmpty
boolean isEmpty() -
toHumanReadableString
String toHumanReadableString() -
find
-
isTransient
- Returns:
- True if the value is transient, so it won't be serialized if serialization of transient value is disabled.
-
setTransient
-
isOfType
Ignores untyped values (considers them non-matching). Supports non-static types. (May be slower.) -
cloneIfImmutable
-
isObjectable
default boolean isObjectable()Returns `true` if this value represents aPrismObject
value. Temporary implementation that uses real value to do the check, asPrismObjectValue
can mask itself as aPrismContainerValue
, at least for now. -
getSchemaContext
SchemaContext getSchemaContext() -
schemaLookup
- Specified by:
schemaLookup
in interfaceSchemaLookup.Aware
-