Package ca.uhn.hl7v2.parser
Class GenericModelClassFactory
java.lang.Object
ca.uhn.hl7v2.parser.AbstractModelClassFactory
ca.uhn.hl7v2.parser.GenericModelClassFactory
- All Implemented Interfaces:
ModelClassFactory,Serializable
GenericModelClassFactory is a ModelClassFactory implementation
which always returns generic types:
This can be used to run HAPI without any structure JARs, as the generic MCF has no structure dependencies. See the using multiple versions example for more information.
In combination with ParserConfiguration.setAllowUnknownVersions(boolean), the GenericModelClassFactory
can be used to parse future versions of HL7 for which HAPI has no support.
- Author:
- James Agnew
- See Also:
-
Field Summary
Fields inherited from class ca.uhn.hl7v2.parser.AbstractModelClassFactory
DEFAULT_EVENT_MAP_DIRECTORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGroupClass(String theName, String theVersion) getMessageClass(String theName, String theVersion, boolean theIsExplicit) getMessageClassInASpecificPackage(String theName, String theVersion, boolean theIsExplicit, String thePackageName) Retrieves a message class by looking in a specific java package for the message type.getSegmentClass(String theName, String theVersion) getTypeClass(String theName, String theVersion) Methods inherited from class ca.uhn.hl7v2.parser.AbstractModelClassFactory
getEventMapDirectory, getEventMapForVersion, getMessageStructureForEvent, loadMessageStructures, setEventMapDirectory
-
Constructor Details
-
GenericModelClassFactory
public GenericModelClassFactory()
-
-
Method Details
-
getMessageClass
public Class<? extends Message> getMessageClass(String theName, String theVersion, boolean theIsExplicit) - Parameters:
theName- name of messagetheVersion- HL7 versiontheIsExplicit- true if the structure was specified explicitly in MSH-9-3, false if it was inferred from MSH-9-1 and MSH-9-2. If false, a lookup may be performed to find an alternate structure corresponding to that message type and event.- Returns:
- a class that implements the specified message
-
getMessageClassInASpecificPackage
public Class<? extends Message> getMessageClassInASpecificPackage(String theName, String theVersion, boolean theIsExplicit, String thePackageName) Retrieves a message class by looking in a specific java package for the message type.- Parameters:
theName- The message structure type (e.g. "ADT_A01")theVersion- The HL7 version (e.g. "2.3.1")theIsExplicit- If false, the message structure is looked up usingParser.getMessageStructureForEvent(String, String)and converted to the appropriate structure type. For example, "ADT_A04" would be converted to "ADT_A01" because the A04 trigger uses the A01 message structure according to HL7.thePackageName- The package name to use. Note that if the message type can't be found in this package, HAPI will return the standard type returned byModelClassFactory.getMessageClass(String, String, boolean)- Returns:
- message class
-
getGroupClass
- Parameters:
theName- name of grouptheVersion- HL7 version- Returns:
- a class that implements the specified group
-
getSegmentClass
- Parameters:
theName- name of segmenttheVersion- HL7 version- Returns:
- a class that implements the specified segment
-
getTypeClass
- Parameters:
theName- name of typetheVersion- HL7 version- Returns:
- a class that implements the specified type
-