FileDocCategorySizeDatePackage
DefaultableListType.javaAPI DocHibernate 3.2.52361Tue May 08 22:52:56 BST 2007org.hibernate.test.usercollection.parameterized

DefaultableListType

public class DefaultableListType extends Object implements org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserCollectionType
Our Hibernate type-system extension for defining our specialized collection contract.
author
Holger Brands
author
Steve Ebersole

Fields Summary
private String
defaultValue
Constructors Summary
Methods Summary
public booleancontains(java.lang.Object collection, java.lang.Object entity)

		return ( ( DefaultableList ) collection ).contains( entity );
	
public java.util.IteratorgetElementsIterator(java.lang.Object collection)

		return ( ( DefaultableList ) collection ).iterator();
	
public java.lang.ObjectindexOf(java.lang.Object collection, java.lang.Object entity)

		int index = ( ( DefaultableList ) collection ).indexOf( entity );
		return index >= 0 ? new Integer( index ) : null;
	
public java.lang.Objectinstantiate(int anticipatedSize)

		DefaultableListImpl list = anticipatedSize < 0 ? new DefaultableListImpl() : new DefaultableListImpl( anticipatedSize );
		list.setDefaultValue( defaultValue );
		return list;
	
public org.hibernate.collection.PersistentCollectioninstantiate(org.hibernate.engine.SessionImplementor session, org.hibernate.persister.collection.CollectionPersister persister)

		return new PersistentDefaultableList( session );
	
public java.lang.ObjectreplaceElements(java.lang.Object original, java.lang.Object target, org.hibernate.persister.collection.CollectionPersister persister, java.lang.Object owner, java.util.Map copyCache, org.hibernate.engine.SessionImplementor session)

		DefaultableList result = ( DefaultableList ) target;
		result.clear();
		result.addAll( ( DefaultableList ) original );
		return result;
	
public voidsetParameterValues(java.util.Properties parameters)

        defaultValue = parameters.getProperty( "default" );
	
public org.hibernate.collection.PersistentCollectionwrap(org.hibernate.engine.SessionImplementor session, java.lang.Object collection)

		if ( session.getEntityMode() == EntityMode.DOM4J ) {
			throw new IllegalStateException( "dom4j not supported" );
		}
		else {
			return new PersistentDefaultableList( session, ( List ) collection );
		}