FileDocCategorySizeDatePackage
PersistentListElementHolder.javaAPI DocHibernate 3.2.52213Fri May 20 14:50:08 BST 2005org.hibernate.collection

PersistentListElementHolder

public class PersistentListElementHolder extends PersistentIndexedElementHolder
author
Gavin King

Fields Summary
Constructors Summary
public PersistentListElementHolder(org.hibernate.engine.SessionImplementor session, org.dom4j.Element element)

		super( session, element );
	
public PersistentListElementHolder(org.hibernate.engine.SessionImplementor session, org.hibernate.persister.collection.CollectionPersister persister, Serializable key)

		super( session, persister, key );
	
Methods Summary
public java.io.Serializabledisassemble(org.hibernate.persister.collection.CollectionPersister persister)

				
		Type elementType = persister.getElementType();
		final String indexNodeName = getIndexAttributeName(persister);
		List elements =  element.elements( persister.getElementNodeName() );
		int length = elements.size();
		Serializable[] result = new Serializable[length];
		for ( int i=0; i<length; i++ ) {
			Element elem = (Element) elements.get(i);
			Object object = elementType.fromXMLNode( elem, persister.getFactory() );
			Integer index = (Integer) Hibernate.INTEGER.fromStringValue( getIndex(elem, indexNodeName, i) );
			result[ index.intValue() ] = elementType.disassemble( object, getSession(), null );
		}
		return result;
	
public voidinitializeFromCache(org.hibernate.persister.collection.CollectionPersister persister, java.io.Serializable disassembled, java.lang.Object owner)

		
		Type elementType = persister.getElementType();
		final String indexNodeName = getIndexAttributeName(persister);
		Serializable[] cached = (Serializable[]) disassembled;
		for ( int i=0; i<cached.length; i++ ) {
			Object object = elementType.assemble( cached[i], getSession(), owner );
			Element subelement = element.addElement( persister.getElementNodeName() );
			elementType.setToXMLNode( subelement, object, persister.getFactory() );
			setIndex( subelement, indexNodeName, Integer.toString(i) );
		}