public abstract class AbstractType extends Object implements Type
Constructor and Description |
---|
AbstractType(Message message)
Creates a new instance of AbstractType
|
Modifier and Type | Method and Description |
---|---|
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)
|
boolean |
isEmpty()
Returns true if this Visitable has actual content
|
void |
parse(String string)
Parses the string into this type and replaces the current contents with
the parsed value.
|
Location |
provideLocation(Location location,
int index,
int repetition)
Reusing the location of this object's parent, this method returns its own
location within the message.
|
String |
toString()
Returns the datatype and attempts to pipe-encode it.
|
public AbstractType(Message message)
message
- message to which this type belongspublic String getName()
public ExtraComponents getExtraComponents()
Type
getExtraComponents
in interface Type
Type.getExtraComponents()
public Message getMessage()
getMessage
in interface Type
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:
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 Type
string
- the message to be parsedHL7Exception
- if errors occurred while parsingpublic String encode() throws HL7Exception
encode
in interface Type
HL7Exception
- if errors occurred while encodingpublic boolean isEmpty() throws HL7Exception
isEmpty
in interface Visitable
HL7Exception
- if an error occurred while determining emptinesspublic String toString()
public Location provideLocation(Location location, int index, int repetition)
Visitable
provideLocation
in interface Visitable
location
- the parents locationindex
- index of this objectrepetition
- repetition of this objectCopyright © 2001–2017 University Health Network. All rights reserved.