1 // $Id: Instantiator.java,v 1.5 2005/07/11 17:31:50 steveebersole Exp $ 2 package org.hibernate.tuple; 3 4 5 import java.io.Serializable; 6 7 /** 8 * Contract for implementors responsible for instantiating entity/component instances. 9 * 10 * @author Steve Ebersole 11 */ 12 public interface Instantiator extends Serializable { 13 14 /** 15 * Perform the requested entity instantiation. 16 * <p/> 17 * This form is never called for component instantiation, only entity instantiation. 18 * 19 * @param id The id of the entity to be instantiated. 20 * @return An appropriately instantiated entity. 21 */ 22 public Object instantiate(Serializable id); 23 24 /** 25 * Perform the requested instantiation. 26 * 27 * @return The instantiated data structure. 28 */ 29 public Object instantiate(); 30 31 /** 32 * Performs check to see if the given object is an instance of the entity 33 * or component which this Instantiator instantiates. 34 * 35 * @param object The object to be checked. 36 * @return True is the object does respresent an instance of the underlying 37 * entity/component. 38 */ 39 public boolean isInstance(Object object); 40 } 41