|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.uhn.hl7v2.parser.DefaultModelClassFactory
ca.uhn.hl7v2.parser.CanonicalModelClassFactory
public class CanonicalModelClassFactory
Specialized version of ModelClassFactory that always returns the same version. This is useful when designing applications which are expected to handle multiple versions of HL7. The recommended approach is to configure this factory to handle the newest version of HL7 you intend to support. Since HL7 is a backwards compatible protocol, older versions should always be able to parse correctly into a newer message structure.
Constructor Summary | |
---|---|
CanonicalModelClassFactory()
Constructor which selects the newest version of HAPI known to |
|
CanonicalModelClassFactory(java.lang.String theVersion)
Constructor |
Method Summary | |
---|---|
java.lang.Class<? extends Group> |
getGroupClass(java.lang.String theName,
java.lang.String theVersion)
|
java.lang.Class<? extends Message> |
getMessageClass(java.lang.String theName,
java.lang.String theVersion,
boolean theIsExplicit)
Attempts to return the message class corresponding to the given name, by searching through default and user-defined (as per packageList()) packages. |
java.lang.Class<? extends Segment> |
getSegmentClass(java.lang.String theName,
java.lang.String theVersion)
|
java.lang.Class<? extends Type> |
getTypeClass(java.lang.String theName,
java.lang.String theVersion)
|
Methods inherited from class ca.uhn.hl7v2.parser.DefaultModelClassFactory |
---|
getHighestKnownVersion, getVersionPackageName, getVersionPackagePath, packageList, reloadPackages |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CanonicalModelClassFactory()
theVersion
- The version to always return (e.g. "2.6")public CanonicalModelClassFactory(java.lang.String theVersion)
theVersion
- The version to always return (e.g. "2.6")Method Detail |
---|
public java.lang.Class<? extends Group> getGroupClass(java.lang.String theName, java.lang.String theVersion) throws HL7Exception
getGroupClass
in interface ModelClassFactory
getGroupClass
in class DefaultModelClassFactory
theName
- name of grouptheVersion
- HL7 version
HL7Exception
- if the version if not recognized or an appropriate class can not be foundModelClassFactory.getGroupClass(java.lang.String, java.lang.String)
public java.lang.Class<? extends Message> getMessageClass(java.lang.String theName, java.lang.String theVersion, boolean theIsExplicit) throws HL7Exception
Attempts to return the message class corresponding to the given name, by searching through default and user-defined (as per packageList()) packages. Returns GenericMessage if the class is not found.
It is important to note that there can only be one implementation of a particular message
structure (i.e. one class with the message structure name, regardless of its package) among
the packages defined as per the packageList()
method. If there are duplicates
(e.g. two ADT_A01 classes) the first one in the search order will always be used. However,
this restriction only applies to message classes, not (normally) segment classes, etc. This is because
classes representing parts of a message are referenced explicitly in the code for the message
class, rather than being looked up (using findMessageClass() ) based on the String value of MSH-9.
The exception is that Segments may have to be looked up by name when they appear
in unexpected locations (e.g. by local extension) -- see findSegmentClass().
Note: the current implementation will be slow if there are multiple user- defined packages, because the JVM will try to load a number of non-existent classes every parse. This should be changed so that specific classes, rather than packages, are registered by name.
getMessageClass
in interface ModelClassFactory
getMessageClass
in class DefaultModelClassFactory
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.
HL7Exception
- if the version if not recognized or an appropriate class can not be foundpublic java.lang.Class<? extends Segment> getSegmentClass(java.lang.String theName, java.lang.String theVersion) throws HL7Exception
getSegmentClass
in interface ModelClassFactory
getSegmentClass
in class DefaultModelClassFactory
theName
- name of segmenttheVersion
- HL7 version
HL7Exception
- if the version if not recognized or an appropriate class can not be foundModelClassFactory.getSegmentClass(java.lang.String, java.lang.String)
public java.lang.Class<? extends Type> getTypeClass(java.lang.String theName, java.lang.String theVersion) throws HL7Exception
getTypeClass
in interface ModelClassFactory
getTypeClass
in class DefaultModelClassFactory
theName
- name of typetheVersion
- HL7 version
HL7Exception
- if the version if not recognized or an appropriate class can not be foundModelClassFactory.getTypeClass(java.lang.String, java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |