ca.uhn.hl7v2.model
Class AbstractPrimitive

java.lang.Object
  extended by ca.uhn.hl7v2.model.AbstractType
      extended by ca.uhn.hl7v2.model.AbstractPrimitive
All Implemented Interfaces:
Primitive, Type, java.io.Serializable
Direct Known Subclasses:
DT, GenericPrimitive, ID, IS, NULLDT, TM, TSComponentOne

public abstract class AbstractPrimitive
extends AbstractType
implements Primitive

Base class for Primitives. Performs validation in setValue().

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
AbstractPrimitive(Message message)
           
 
Method Summary
 void clear()
          Clears all data from this type
 java.lang.String encode()
          Encodes this message using the parser returned by #getParser()
 java.lang.String getValue()
          Returns a String representation of the value of this field.
 void parse(java.lang.String string)
          Parses the string into this message using the parser returned by #getParser()
 void setValue(java.lang.String theValue)
          Sets the value of this Primitive, first performing validation as specified by getMessage().getValidationContext().
 java.lang.String toString()
          Returns the value of getValue()
 
Methods inherited from class ca.uhn.hl7v2.model.AbstractType
getExtraComponents, getMessage, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.uhn.hl7v2.model.Type
getExtraComponents, getMessage, getName
 

Constructor Detail

AbstractPrimitive

public AbstractPrimitive(Message message)
Parameters:
message - message to which this type belongs
Method Detail

toString

public java.lang.String toString()
Returns the value of getValue()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getValue

public java.lang.String getValue()
Description copied from interface: Primitive
Returns a String representation of the value of this field.

Specified by:
getValue in interface Primitive
See Also:
Primitive.getValue()

setValue

public void setValue(java.lang.String theValue)
              throws DataTypeException
Sets the value of this Primitive, first performing validation as specified by getMessage().getValidationContext(). No validation is performed if getMessage() returns null.

Specified by:
setValue in interface Primitive
Throws:
DataTypeException - if the given value is not valid in this context.
See Also:
Primitive.setValue(String)

encode

public java.lang.String encode()
                        throws HL7Exception
Encodes this message using the parser returned by #getParser()

Specified by:
encode in interface Type
Overrides:
encode in class AbstractType
Throws:
HL7Exception

parse

public void parse(java.lang.String string)
           throws HL7Exception
Parses the string into this message using the parser returned by #getParser()

Specified by:
parse in interface Type
Overrides:
parse in class AbstractType
Throws:
HL7Exception

clear

public void clear()
Clears all data from this type

Specified by:
clear in interface Type
Overrides:
clear in class AbstractType


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