Interface CollectionSemantics<CE,E>
- Type Parameters:
CE- the type of the collectionE- the collection element or map key type
- All Known Subinterfaces:
BagSemantics<BE,E>, MapSemantics<MKV, K, V>
- All Known Implementing Classes:
AbstractBagSemantics, AbstractMapSemantics, AbstractSetSemantics
Each instance of this interface describes the semantics of some sort of
persistent collection so that Hibernate understands how to manage the
lifecycle of instances of that sort of collection.
A collection type with semantics described by a CollectionSemantics
object need not be part of the Java Collections Framework.
- Since:
- 6.0
-
Method Summary
Modifier and TypeMethodDescriptionintcollectionSize(Object rawCollection) Determine the size of the given raw collection.copy(Object rawCollection, CollectionPersister collectionDescriptor) Create a raw (unwrapped) copy of the given collection.Set<?> copyPart(Object rawCollection, CollectionPersister collectionDescriptor, CollectionPart.Nature partNature) Create a detached copy of a collection part.default CollectionInitializerProducercreateInitializerProducer(NavigablePath navigablePath, PluralAttributeMapping attributeMapping, FetchParent fetchParent, boolean selected, String resultVariable, DomainResultCreationState creationState) Create a producer forCollectionInitializerinstances for the given collection semanticsdefault CollectionInitializerProducercreateInitializerProducer(NavigablePath navigablePath, PluralAttributeMapping attributeMapping, FetchParent fetchParent, boolean selected, String resultVariable, Fetch indexFetch, Fetch elementFetch, DomainResultCreationState creationState) Create a producer forCollectionInitializerinstances for the given collection semanticsThe classification handled by this semanticClass<?> The collection's Java typegetElementIterator(CE rawCollection) Obtain an iterator over the collection elementsinstantiateRaw(int anticipatedSize, CollectionPersister collectionDescriptor) Create a raw (unwrapped) version of the collectiondefault <X> ObjectinstantiateWithElements(int anticipatedSize, CollectionPersister collectionDescriptor, Collection<? extends X> elements) Create a raw (unwrapped) version of the collection and populate it with the given elements.default <K,V> Map <K, V> instantiateWithElements(int anticipatedSize, CollectionPersister collectionDescriptor, Map<? extends K, ? extends V> entries) Create a raw (unwrapped) version of the collection and populate it with the given map entries.instantiateWrapper(Object key, CollectionPersister collectionDescriptor, SharedSessionContractImplementor session) Create a wrapper for the collectionvoidvisitElements(CE rawCollection, Consumer<? super E> action) Visit the elements of the collectionwrap(CE rawCollection, CollectionPersister collectionDescriptor, SharedSessionContractImplementor session) Wrap a raw collection in wrapper
-
Method Details
-
getCollectionClassification
CollectionClassification getCollectionClassification()The classification handled by this semantic -
getCollectionJavaType
Class<?> getCollectionJavaType()The collection's Java type -
instantiateRaw
Create a raw (unwrapped) version of the collection -
instantiateWithElements
default <X> Object instantiateWithElements(int anticipatedSize, CollectionPersister collectionDescriptor, Collection<? extends X> elements) Create a raw (unwrapped) version of the collection and populate it with the given elements. -
instantiateWithElements
default <K,V> Map<K,V> instantiateWithElements(int anticipatedSize, CollectionPersister collectionDescriptor, Map<? extends K, ? extends V> entries) Create a raw (unwrapped) version of the collection and populate it with the given map entries. -
collectionSize
Determine the size of the given raw collection. -
copy
Create a raw (unwrapped) copy of the given collection. -
copyPart
Set<?> copyPart(Object rawCollection, CollectionPersister collectionDescriptor, CollectionPart.Nature partNature) Create a detached copy of a collection part. -
getElementIterator
-
visitElements
-