KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > usertype > UserCollectionType


1 //$Id: UserCollectionType.java,v 1.6 2005/07/06 03:11:14 oneovthafew Exp $
2
package org.hibernate.usertype;
3
4 import java.util.Iterator JavaDoc;
5 import java.util.Map JavaDoc;
6
7 import org.hibernate.HibernateException;
8 import org.hibernate.collection.PersistentCollection;
9 import org.hibernate.engine.SessionImplementor;
10 import org.hibernate.persister.collection.CollectionPersister;
11
12 /**
13  * A custom type for mapping user-written classes that implement <tt>PersistentCollection</tt>
14  *
15  * @see org.hibernate.collection.PersistentCollection
16  * @author Gavin King
17  */

18 public interface UserCollectionType {
19     
20     /**
21      * Instantiate an uninitialized instance of the collection wrapper
22      */

23     public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister)
24     throws HibernateException;
25     
26     /**
27      * Wrap an instance of a collection
28      */

29     public PersistentCollection wrap(SessionImplementor session, Object JavaDoc collection);
30     
31     /**
32      * Return an iterator over the elements of this collection - the passed collection
33      * instance may or may not be a wrapper
34      */

35     public Iterator JavaDoc getElementsIterator(Object JavaDoc collection);
36
37     /**
38      * Optional operation. Does the collection contain the entity instance?
39      */

40     public boolean contains(Object JavaDoc collection, Object JavaDoc entity);
41     /**
42      * Optional operation. Return the index of the entity in the collection.
43      */

44     public Object JavaDoc indexOf(Object JavaDoc collection, Object JavaDoc entity);
45     
46     /**
47      * Replace the elements of a collection with the elements of another collection
48      */

49     public Object JavaDoc replaceElements(
50             Object JavaDoc original,
51             Object JavaDoc target,
52             CollectionPersister persister,
53             Object JavaDoc owner,
54             Map JavaDoc copyCache,
55             SessionImplementor session)
56             throws HibernateException;
57     
58     /**
59      * Instantiate an empty instance of the "underlying" collection (not a wrapper)
60      */

61     public Object JavaDoc instantiate();
62     
63 }
64
Popular Tags