FileDocCategorySizeDatePackage
DynamicMapInstantiator.javaAPI DocHibernate 3.2.51573Fri Jul 29 01:14:16 BST 2005org.hibernate.tuple

DynamicMapInstantiator

public class DynamicMapInstantiator extends Object implements Instantiator

Fields Summary
public static final String
KEY
private String
entityName
private Set
isInstanceEntityNames
Constructors Summary
public DynamicMapInstantiator()


	  
		this.entityName = null;
	
public DynamicMapInstantiator(org.hibernate.mapping.PersistentClass mappingInfo)

		this.entityName = mappingInfo.getEntityName();
		isInstanceEntityNames.add( entityName );
		if ( mappingInfo.hasSubclasses() ) {
			Iterator itr = mappingInfo.getSubclassClosureIterator();
			while ( itr.hasNext() ) {
				final PersistentClass subclassInfo = ( PersistentClass ) itr.next();
				isInstanceEntityNames.add( subclassInfo.getEntityName() );
			}
		}
	
Methods Summary
protected java.util.MapgenerateMap()

		return new HashMap();
	
public final java.lang.Objectinstantiate(java.io.Serializable id)

		return instantiate();
	
public final java.lang.Objectinstantiate()

		Map map = generateMap();
		if ( entityName!=null ) {
			map.put( KEY, entityName );
		}
		return map;
	
public final booleanisInstance(java.lang.Object object)

		if ( object instanceof Map ) {
			if ( entityName == null ) {
				return true;
			}
			String type = ( String ) ( ( Map ) object ).get( KEY );
			return type == null || isInstanceEntityNames.contains( type );
		}
		else {
			return false;
		}