public abstract class AbstractPrimitive extends AbstractType implements Primitive
| Constructor and Description |
|---|
AbstractPrimitive(Message message) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears all data from this type
|
String |
encode()
Encodes this type using HL7 encoding.
|
String |
getValue()
Returns a String representation of the value of this field.
|
boolean |
isEmpty()
Does this type have any actual content
|
void |
parse(String string)
Parses the string into this type and replaces the current contents with
the parsed value.
|
void |
setValue(String theValue)
Sets the value of this Primitive, first performing validation as specified
by
getMessage().getValidationContext(). |
String |
toString()
Returns the value of getValue()
|
getExtraComponents, getMessage, getNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetExtraComponents, getMessage, getNamepublic AbstractPrimitive(Message message)
message - message to which this type belongspublic String toString()
toString in class AbstractTypeObject.toString()public String getValue()
PrimitivegetValue in interface PrimitivePrimitive.getValue()public void setValue(String theValue) throws DataTypeException
getMessage().getValidationContext(). No validation is performed
if getMessage() returns null.
Note: as of the next HAPI release, the ValidationContext will be retrieved from getParser().getValidationContext(), which ultimately is the ValidationContext of the active HapiContext.
setValue in interface PrimitivetheValue - the value to be setDataTypeException - if the given value is not valid in this context.Primitive.setValue(String)public String encode() throws HL7Exception
encode in interface Typeencode in class AbstractTypeHL7Exceptionpublic 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:
Primitive.setValue(String), the ampersand is treated as an actual ampersand
in the text, and the field will be treated as a single field which is encoded as "milk\T\cookies" (\T\ is the
escape sequence for the subcomponent delimiter).
This method makes use of the parser which is stored within the enclosing Message.
At this time, only PipeParsers are supported.
parse in interface Typeparse in class AbstractTypeHL7Exceptionpublic void clear()
clear in interface Typeclear in class AbstractTypepublic boolean isEmpty()
AbstractTypeisEmpty in interface TypeisEmpty in class AbstractTypeCopyright © 2001-2013 University Health Network. All Rights Reserved.