Package com.evolveum.midpoint.prism.lazy
Class FlyweightClonedItem<V extends PrismValue,D extends ItemDefinition<?>>
java.lang.Object
com.evolveum.midpoint.prism.lazy.FlyweightClonedItem<V,D>
- Type Parameters:
V-D-
- All Implemented Interfaces:
ComplexCopyable<Item<V,,D>> ItemDelegator<V,,D> Freezable,Item<V,,D> Itemable,ParentVisitable,PathVisitable,PrismVisitable,Revivable,Visitable,DebugDumpable,Serializable,Cloneable
public abstract class FlyweightClonedItem<V extends PrismValue,D extends ItemDefinition<?>>
extends Object
implements ItemDelegator<V,D>
Flyweight immutable item backed by delegate.
Flyweight immutable item is special implementation of item, which is semantically clone
of another item, almost fully immutable, but allows this clone to be used in
different place (setParent is mutable - eg. deltas) without need to do deep clone of all children.
When value is accessed a temporary flyweight clone with proper
PrismValue.getParent() is created.
This lightweight clones are not cached and are created each time to simplify state tracking and
to prevent creation of full clone.- See Also:
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRINGFields inherited from interface com.evolveum.midpoint.prism.Item
KEY_NAMESPACE_CONTEXT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Literal clone.static Item<?,?> Deprecated.protected abstract VcreateWrapped(V value) static @NotNull Item<?,?> static <C extends Containerable>
@NotNull PrismContainer<C>from(@NotNull PrismContainer<C> container) static <O extends Objectable>
@NotNull PrismObject<O>from(@NotNull PrismObject<O> object) static <T> @NotNull PrismProperty<T>from(@NotNull PrismProperty<T> property) static @NotNull PrismReferencefrom(@NotNull PrismReference reference) Returns any of the values.getAnyValue(@NotNull ValueSelector<V> selector) Returns a value matching given selector (or null if none exists).@Nullable PrismContainerValue<?>Returns the parent of this item (if exists).getValue()Returns the value, if there is only one.Returns the values for this item.voidsetParent(@Nullable PrismContainerValue<?> parentValue) Sets the parent of this item.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.prism.Item
copy, equals, hashCode, immutableCopy, mutableCopyMethods inherited from interface com.evolveum.midpoint.prism.deleg.ItemDelegator
accept, accept, acceptParentVisitor, acceptVisitor, add, add, addAll, addAll, addIgnoringEquivalents, addRespectingMetadataAndCloning, applyDefinition, applyDefinition, applyDefinitionIfMissing, assertDefinitions, assertDefinitions, assertDefinitions, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistence, checkConsistenceInternal, checkImmutable, checkMutable, clear, cloneComplex, contains, contains, createDelta, createDelta, createImmutableClone, debugDump, debugDump, debugDumpLazily, debugDumpLazily, delegate, diff, diff, equals, equals, filterValues, filterYields, find, findPartial, findValue, findValue, freeze, getAllItems, getAllValues, getClonedValues, getDefinition, getDisplayName, getElementName, getHelp, getHighestId, getNamespaceContext, getPath, getRealValue, getRealValue, getRealValues, getRealValues, getRealValuesArray, getRealValuesOrRawTypes, getUserData, getUserData, hasAnyValue, hasCompleteDefinition, hashCode, hashCode, hasNoValues, hasRaw, isEmpty, isImmutable, isIncomplete, isOperational, isRaw, isSingleValue, isSingleValueByDefinition, merge, normalize, recomputeAllValues, remove, remove, removeAll, removeIf, removeRespectingMetadata, replace, replaceAll, revive, setDefinition, setElementName, setIncomplete, setUserData, size, valuesStream
-
Constructor Details
-
FlyweightClonedItem
public FlyweightClonedItem()
-
-
Method Details
-
from
-
from
@NotNull public static <T> @NotNull PrismProperty<T> from(@NotNull @NotNull PrismProperty<T> property) -
from
@NotNull public static <C extends Containerable> @NotNull PrismContainer<C> from(@NotNull @NotNull PrismContainer<C> container) -
from
@NotNull public static <O extends Objectable> @NotNull PrismObject<O> from(@NotNull @NotNull PrismObject<O> object) -
from
-
copyOf
Deprecated. -
getParent
Description copied from interface:ItemReturns the parent of this item (if exists). Currently this has to be a PrismContainerValue.- Specified by:
getParentin interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Specified by:
getParentin interfaceItemDelegator<V extends PrismValue,D extends ItemDefinition<?>> - Returns:
- The parent if exists
-
setParent
Description copied from interface:ItemSets the parent of this item.- Specified by:
setParentin interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Specified by:
setParentin interfaceItemDelegator<V extends PrismValue,D extends ItemDefinition<?>> - Parameters:
parentValue- The new parent
-
createWrapped
-
getValues
Description copied from interface:ItemReturns the values for this item. Although the ordering of this values is not important, and each value should be present at most once, we currently return them as a list instead of a set. TODO reconsider this FIXME we should return immutable list, to avoid manipulating the values directly FIXME and maybe we should return List<? extends V> to avoid specializing the values, see ShadowAssociationValue in midPoint- Specified by:
getValuesin interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Specified by:
getValuesin interfaceItemDelegator<V extends PrismValue,D extends ItemDefinition<?>>
-
getAnyValue
Description copied from interface:ItemReturns a value matching given selector (or null if none exists).- Specified by:
getAnyValuein interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Specified by:
getAnyValuein interfaceItemDelegator<V extends PrismValue,D extends ItemDefinition<?>>
-
getValue
Description copied from interface:ItemReturns the value, if there is only one. Throws exception if there are more values. If there is no value, this method either: - returns null (for properties) - throws an exception (for items that can hold multiple values) - creates an empty value (for containers and references). TODO think again whether getOrCreateValue would not be better- Specified by:
getValuein interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Specified by:
getValuein interfaceItemDelegator<V extends PrismValue,D extends ItemDefinition<?>>
-
getAnyValue
Description copied from interface:ItemReturns any of the values. Usually called when we are quite confident that there is only a single value; or we don't care which of the values we get. Does not create values if there are none.- Specified by:
getAnyValuein interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Specified by:
getAnyValuein interfaceItemDelegator<V extends PrismValue,D extends ItemDefinition<?>>
-
clone
Description copied from interface:ItemLiteral clone.- Specified by:
clonein interfaceItem<V extends PrismValue,D extends ItemDefinition<?>> - Overrides:
clonein classObject
-