org.hibernate.test.usercollection.parameterized
Class DefaultableListType

java.lang.Object
  extended by org.hibernate.test.usercollection.parameterized.DefaultableListType
All Implemented Interfaces:
ParameterizedType, UserCollectionType

public class DefaultableListType
extends Object
implements UserCollectionType, ParameterizedType

Our Hibernate type-system extension for defining our specialized collection contract.


Constructor Summary
DefaultableListType()
           
 
Method Summary
 boolean contains(Object collection, Object entity)
          Optional operation.
 Iterator getElementsIterator(Object collection)
          Return an iterator over the elements of this collection - the passed collection instance may or may not be a wrapper
 Object indexOf(Object collection, Object entity)
          Optional operation.
 Object instantiate(int anticipatedSize)
          Instantiate an empty instance of the "underlying" collection (not a wrapper), but with the given anticipated size (i.e.
 PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister)
          Instantiate an uninitialized instance of the collection wrapper
 Object replaceElements(Object original, Object target, CollectionPersister persister, Object owner, Map copyCache, SessionImplementor session)
          Replace the elements of a collection with the elements of another collection
 void setParameterValues(Properties parameters)
          Gets called by Hibernate to pass the configured type parameters to the implementation.
 PersistentCollection wrap(SessionImplementor session, Object collection)
          Wrap an instance of a collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultableListType

public DefaultableListType()
Method Detail

instantiate

public Object instantiate(int anticipatedSize)
Description copied from interface: UserCollectionType
Instantiate an empty instance of the "underlying" collection (not a wrapper), but with the given anticipated size (i.e. accounting for initial size and perhaps load factor).

Specified by:
instantiate in interface UserCollectionType
Parameters:
anticipatedSize - The anticipated size of the instaniated collection after we are done populating it. Note, may be negative to indicate that we not yet know anything about the anticipated size (i.e., when initializing from a result set row by row).

instantiate

public PersistentCollection instantiate(SessionImplementor session,
                                        CollectionPersister persister)
Description copied from interface: UserCollectionType
Instantiate an uninitialized instance of the collection wrapper

Specified by:
instantiate in interface UserCollectionType

wrap

public PersistentCollection wrap(SessionImplementor session,
                                 Object collection)
Description copied from interface: UserCollectionType
Wrap an instance of a collection

Specified by:
wrap in interface UserCollectionType

getElementsIterator

public Iterator getElementsIterator(Object collection)
Description copied from interface: UserCollectionType
Return an iterator over the elements of this collection - the passed collection instance may or may not be a wrapper

Specified by:
getElementsIterator in interface UserCollectionType

contains

public boolean contains(Object collection,
                        Object entity)
Description copied from interface: UserCollectionType
Optional operation. Does the collection contain the entity instance?

Specified by:
contains in interface UserCollectionType

indexOf

public Object indexOf(Object collection,
                      Object entity)
Description copied from interface: UserCollectionType
Optional operation. Return the index of the entity in the collection.

Specified by:
indexOf in interface UserCollectionType

replaceElements

public Object replaceElements(Object original,
                              Object target,
                              CollectionPersister persister,
                              Object owner,
                              Map copyCache,
                              SessionImplementor session)
Description copied from interface: UserCollectionType
Replace the elements of a collection with the elements of another collection

Specified by:
replaceElements in interface UserCollectionType

setParameterValues

public void setParameterValues(Properties parameters)
Description copied from interface: ParameterizedType
Gets called by Hibernate to pass the configured type parameters to the implementation.

Specified by:
setParameterValues in interface ParameterizedType


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.