001 /* 002 * Created on 21-Apr-2005 003 */ 004 package ca.uhn.hl7v2.parser; 005 006 import java.io.Serializable; 007 008 import ca.uhn.hl7v2.HL7Exception; 009 import ca.uhn.hl7v2.model.Group; 010 import ca.uhn.hl7v2.model.Message; 011 import ca.uhn.hl7v2.model.Segment; 012 import ca.uhn.hl7v2.model.Type; 013 014 /** 015 * Looks up classes for message model components (e.g. concrete implementations of 016 * Message, Group, Segment). A custom factory can be used to point to custom model 017 * components. 018 * 019 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 020 * @version $Revision: 1.3 $ updated on $Date: 2009/10/03 15:25:46 $ by $Author: jamesagnew $ 021 */ 022 public interface ModelClassFactory extends Serializable { 023 024 /** 025 * @param theName name of message 026 * @param theVersion HL7 version 027 * @param isExplicit true if the structure was specified explicitly in MSH-9-3, false if it 028 * was inferred from MSH-9-1 and MSH-9-2. If false, a lookup may be performed to find 029 * an alternate structure corresponding to that message type and event. 030 * @return a class that implements the specified message 031 * @throws HL7Exception if the version if not recognized or an appropriate class can not be found 032 */ 033 public Class<? extends Message> getMessageClass(String theName, String theVersion, boolean isExplicit) throws HL7Exception; 034 035 /** 036 * @param theName name of group 037 * @param theVersion HL7 version 038 * @return a class that implements the specified group 039 * @throws HL7Exception if the version if not recognized or an appropriate class can not be found 040 */ 041 public Class<? extends Group> getGroupClass(String theName, String theVersion) throws HL7Exception; 042 043 /** 044 * @param theName name of segment 045 * @param theVersion HL7 version 046 * @return a class that implements the specified segment 047 * @throws HL7Exception if the version if not recognized or an appropriate class can not be found 048 */ 049 public Class<? extends Segment> getSegmentClass(String theName, String theVersion) throws HL7Exception; 050 051 /** 052 * @param theName name of type 053 * @param theVersion HL7 version 054 * @return a class that implements the specified type 055 * @throws HL7Exception if the version if not recognized or an appropriate class can not be found 056 */ 057 public Class<? extends Type> getTypeClass(String theName, String theVersion) throws HL7Exception; 058 059 }