ca.uhn.hl7v2.model
Class AbstractType

java.lang.Object
  extended by ca.uhn.hl7v2.model.AbstractType
All Implemented Interfaces:
Type, Serializable
Direct Known Subclasses:
AbstractComposite, AbstractPersonNameComposite, AbstractPrimitive

public abstract class AbstractType
extends Object
implements Type

An abstract Type that provides a default implementation of getName().

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
AbstractType(Message message)
          Creates a new instance of AbstractType
 
Method Summary
 void clear()
          Clears all data from this type
 String encode()
          Encodes this type using HL7 encoding.
 ExtraComponents getExtraComponents()
          Returns an object containing any extra (non-standard) components that have been added to this type at run-time.
 Message getMessage()
           
 String getName()
          Returns the name of the type (used in XML encoding and profile checking)
 void parse(String string)
           Parses the string into this type and replaces the current contents with the parsed value.
 String toString()
          Returns the datatype and attempts to pipe-encode it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractType

public AbstractType(Message message)
Creates a new instance of AbstractType

Parameters:
message - message to which this type belongs
Method Detail

getName

public String getName()
Returns the name of the type (used in XML encoding and profile checking)

Specified by:
getName in interface Type

getExtraComponents

public ExtraComponents getExtraComponents()
Description copied from interface: Type
Returns an object containing any extra (non-standard) components that have been added to this type at run-time. This object can also be used to add components.

Specified by:
getExtraComponents in interface Type
See Also:
Type.getExtraComponents()

getMessage

public Message getMessage()
Specified by:
getMessage in interface Type
Returns:
the message to which this Type belongs

parse

public void parse(String string)
           throws HL7Exception

Parses the string into this type and replaces the current contents with the parsed value. This method accepts HL7 encoded text and treats its input as such.

Note that this method is subtly different from calling Primitive.setValue(String), but can be quite powerful. For example, using the argument of "milk&cookies" on an ST datatype:

This method makes use of the parser which is stored within the enclosing Message. At this time, only PipeParsers are supported.

Specified by:
parse in interface Type
Throws:
HL7Exception

encode

public String encode()
              throws HL7Exception
Encodes this type using HL7 encoding.

Specified by:
encode in interface Type
Throws:
HL7Exception

clear

public void clear()
Clears all data from this type

Specified by:
clear in interface Type

toString

public String toString()
Returns the datatype and attempts to pipe-encode it. For example, a string implementation might return "ST[Value^Value2]". This is only intended for logging/debugging purposes.

Overrides:
toString in class Object


Copyright © 2001-2012 University Health Network. All Rights Reserved.