1 package org.hibernate.cache.entry; 3 4 import java.io.Serializable ; 5 6 import org.hibernate.collection.PersistentCollection; 7 import org.hibernate.persister.collection.CollectionPersister; 8 import org.hibernate.util.ArrayHelper; 9 10 13 public class CollectionCacheEntry implements Serializable { 14 15 private final Serializable state; 16 17 public Serializable [] getState() { 18 return (Serializable []) state; 20 } 21 22 public CollectionCacheEntry(PersistentCollection collection, CollectionPersister persister) { 23 this.state = collection.disassemble(persister); 24 } 25 26 CollectionCacheEntry(Serializable state) { 27 this.state = state; 28 } 29 30 public void assemble( 31 final PersistentCollection collection, 32 final CollectionPersister persister, 33 final Object owner 34 ) { 35 collection.initializeFromCache(persister, state, owner); 36 collection.afterInitialize(); 37 } 38 39 public String toString() { 40 return "CollectionCacheEntry" + ArrayHelper.toString( getState() ); 41 } 42 43 } 44 | Popular Tags |