Example usage for org.hibernate.persister.collection CollectionPersister getCollectionType

List of usage examples for org.hibernate.persister.collection CollectionPersister getCollectionType

Introduction

In this page you can find the example usage for org.hibernate.persister.collection CollectionPersister getCollectionType.

Prototype

CollectionType getCollectionType();

Source Link

Document

Get the associated Type

Usage

From source file:org.babyfish.hibernate.collection.spi.persistence.ListBasePersistence.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//  ww  w  . j a  v  a2s .  c om
public void beforeInitialize(CollectionPersister persister, int anticipatedSize) {
    Object instantiate = persister.getCollectionType().instantiate(anticipatedSize);
    if (!(instantiate instanceof MAList<?>)) {
        throw new IllegalProgramException(LAZY_COMMON_RESOURCE.get()
                .illegalInstantiate(persister.getCollectionType().getClass(), MAList.class));
    }
    this.initBase((MAList<E>) instantiate);
}

From source file:org.babyfish.hibernate.collection.spi.persistence.MapBasePersistence.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from   w  ww . j av a 2  s .c om
public void beforeInitialize(CollectionPersister persister, int anticipatedSize) {
    Object instantiate = persister.getCollectionType().instantiate(anticipatedSize);
    if (!(instantiate instanceof MAMap<?, ?>)) {
        throw new IllegalProgramException(LAZY_COMMON_RESOURCE.get()
                .illegalInstantiate(persister.getCollectionType().getClass(), MAMap.class));
    }
    this.initBase((MAMap<K, V>) instantiate);
}

From source file:org.babyfish.hibernate.collection.spi.persistence.SetBasePersistence.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from   w  ww.  j a v  a2 s  . c  o m
public void beforeInitialize(CollectionPersister persister, int anticipatedSize) {
    Object instantiate = persister.getCollectionType().instantiate(anticipatedSize);
    if (!(instantiate instanceof MASet<?>)) {
        throw new IllegalProgramException(LAZY_COMMON_RESOURCE.get()
                .illegalInstantiate(persister.getCollectionType().getClass(), MASet.class));
    }
    this.setBase((MASet<E>) instantiate);
}

From source file:org.babyfish.hibernate.collection.type.AbstractMACollectionType.java

License:Open Source License

protected static Object instantiate(CollectionPersister persister, int anticipatedSize) {
    return ((AbstractMACollectionType) ((CustomCollectionType) persister.getCollectionType()).getUserType())
            .instantiate(anticipatedSize);
}