FileDocCategorySizeDatePackage
EntityModeToTuplizerMapping.javaAPI DocHibernate 3.2.52338Thu Jul 13 19:09:20 BST 2006org.hibernate.tuple

EntityModeToTuplizerMapping

public abstract class EntityModeToTuplizerMapping extends Object implements Serializable
Centralizes handling of {@link EntityMode} to {@link Tuplizer} mappings.
author
Steve Ebersole

Fields Summary
private final Map
tuplizers
Constructors Summary
Methods Summary
protected voidaddTuplizer(org.hibernate.EntityMode entityMode, Tuplizer tuplizer)


	      
		tuplizers.put( entityMode, tuplizer );
	
public TuplizergetTuplizer(org.hibernate.EntityMode entityMode)
Locate the tuplizer contained within this mapping which is responsible for the given entity-mode. If no such tuplizer is defined on this mapping, then an exception is thrown.

param
entityMode The entity-mode for which the caller wants a tuplizer.
return
The tuplizer.
throws
HibernateException Unable to locate the requested tuplizer.

		Tuplizer tuplizer = getTuplizerOrNull( entityMode );
		if ( tuplizer == null ) {
			throw new HibernateException( "No tuplizer found for entity-mode [" + entityMode + "]");
		}
		return tuplizer;
	
public TuplizergetTuplizerOrNull(org.hibernate.EntityMode entityMode)
Locate the contained tuplizer responsible for the given entity-mode. If no such tuplizer is defined on this mapping, then return null.

param
entityMode The entity-mode for which the caller wants a tuplizer.
return
The tuplizer, or null if not found.

		return ( Tuplizer ) tuplizers.get( entityMode );
	
public org.hibernate.EntityModeguessEntityMode(java.lang.Object object)
Given a supposed instance of an entity/component, guess its entity mode.

param
object The supposed instance of the entity/component.
return
The guessed entity mode.

		Iterator itr = tuplizers.entrySet().iterator();
		while( itr.hasNext() ) {
			Map.Entry entry = ( Map.Entry ) itr.next();
			Tuplizer tuplizer = ( Tuplizer ) entry.getValue();
			if ( tuplizer.isInstance( object ) ) {
				return ( EntityMode ) entry.getKey();
			}
		}
		return null;