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:
  • Constructor Details

  • Method Details

    • getMessageClass

      public Class<? extends Message> getMessageClass(String theName, String theVersion, boolean theIsExplicit)
      Parameters:
      theName - name of message
      theVersion - HL7 version
      theIsExplicit - 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 using Parser.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 by ModelClassFactory.getMessageClass(String, String, boolean)
      Returns:
      message class
    • getGroupClass

      public Class<? extends Group> getGroupClass(String theName, String theVersion)
      Parameters:
      theName - name of group
      theVersion - HL7 version
      Returns:
      a class that implements the specified group
    • getSegmentClass

      public Class<? extends Segment> getSegmentClass(String theName, String theVersion)
      Parameters:
      theName - name of segment
      theVersion - HL7 version
      Returns:
      a class that implements the specified segment
    • getTypeClass

      public Class<? extends Type> getTypeClass(String theName, String theVersion)
      Parameters:
      theName - name of type
      theVersion - HL7 version
      Returns:
      a class that implements the specified type