org.hibernate.collection.internal.StandardIdentifierBagSemantics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.collection.internal;
import java.util.Collection;
import org.hibernate.collection.spi.CollectionClassification;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.model.domain.spi.PersistentCollectionDescriptor;
/**
* CollectionSemantics implementation for id-bags
*
* @author Steve Ebersole
*/
public class StandardIdentifierBagSemantics extends AbstractBagSemantics> {
/**
* Singleton access
*/
public static final StandardIdentifierBagSemantics INSTANCE = new StandardIdentifierBagSemantics();
private StandardIdentifierBagSemantics() {
}
@Override
public CollectionClassification getCollectionClassification() {
return CollectionClassification.IDBAG;
}
@Override
public PersistentCollection instantiateWrapper(
Object key,
PersistentCollectionDescriptor, E> collectionDescriptor,
SharedSessionContractImplementor session) {
return new PersistentIdentifierBag<>( session, collectionDescriptor, key );
}
@Override
public PersistentCollection wrap(
Collection rawCollection,
PersistentCollectionDescriptor, E> collectionDescriptor,
SharedSessionContractImplementor session) {
return new PersistentIdentifierBag<>( session, collectionDescriptor, rawCollection );
}
}