FileDocCategorySizeDatePackage
StructuredCacheEntry.javaAPI DocHibernate 3.2.51676Fri Aug 05 11:16:46 BST 2005org.hibernate.cache.entry

StructuredCacheEntry

public class StructuredCacheEntry extends Object implements CacheEntryStructure
author
Gavin King

Fields Summary
private org.hibernate.persister.entity.EntityPersister
persister
Constructors Summary
public StructuredCacheEntry(org.hibernate.persister.entity.EntityPersister persister)

		this.persister = persister;
	
Methods Summary
public java.lang.Objectdestructure(java.lang.Object item, org.hibernate.engine.SessionFactoryImplementor factory)

		Map map = (Map) item;
		boolean lazyPropertiesUnfetched = ( (Boolean) map.get("_lazyPropertiesUnfetched") ).booleanValue();
		String subclass = (String) map.get("_subclass");
		Object version = map.get("_version");
		EntityPersister subclassPersister = factory.getEntityPersister(subclass);
		String[] names = subclassPersister.getPropertyNames();
		Serializable[] state = new Serializable[names.length];
		for ( int i=0; i<names.length; i++ ) {
			state[i] = (Serializable) map.get( names[i] );
		}
		return new CacheEntry(state, subclass, lazyPropertiesUnfetched, version);
	
public java.lang.Objectstructure(java.lang.Object item)

		CacheEntry entry = (CacheEntry) item;
		String[] names = persister.getPropertyNames();
		Map map = new HashMap(names.length+2);
		map.put( "_subclass", entry.getSubclass() );
		map.put( "_version", entry.getVersion() );
		map.put( "_lazyPropertiesUnfetched", entry.areLazyPropertiesUnfetched() ? Boolean.TRUE : Boolean.FALSE );
		for ( int i=0; i<names.length; i++ ) {
			map.put( names[i], entry.getDisassembledState()[i] );
		}
		return map;