Package ca.uhn.hl7v2.model.primitive
Class AbstractTextPrimitive
java.lang.Object
ca.uhn.hl7v2.model.AbstractType
ca.uhn.hl7v2.model.AbstractPrimitive
ca.uhn.hl7v2.model.primitive.AbstractTextPrimitive
- All Implemented Interfaces:
Primitive,Type,Visitable,Serializable
Base class for a textual primitive datatypes such as FT, TX, ST.
- Author:
- James Agnew
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of this type with HL7 defined formatting codes replaced by their HTML equivalent.Returns the value of the datatype as returned byAbstractPrimitive.getValue()but returns an empty string ("") if the value isnull.Methods inherited from class ca.uhn.hl7v2.model.AbstractPrimitive
accept, clear, encode, getValue, isEmpty, parse, setValue, toStringMethods inherited from class ca.uhn.hl7v2.model.AbstractType
getExtraComponents, getMessage, getName, provideLocationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ca.uhn.hl7v2.model.Type
getExtraComponents, getMessage, getNameMethods inherited from interface ca.uhn.hl7v2.model.Visitable
provideLocation
-
Constructor Details
-
AbstractTextPrimitive
Constructor
-
-
Method Details
-
getValueAsHtml
Returns the value of this type with HL7 defined formatting codes replaced by their HTML equivalent.
For example, if this type contained the string:
ABC \.ce\MIDDLE\.br\
This would be returned as:
ABC <center>MIDDLE<center><br>
The following codes are handled (note that contrary to the HL7 specification, codes are interpreted in a case-insensitive manner):
- \.br\ (converted to <br>)
- \.ce\ (converted to <center>)
- \.sk\ (converted to )
- \.sp\ (converted to <br> and then multiple )
- \.sp ###\ (converted to multiple <br> and then multiple )
- \.fi\ (cancels \.nf\)
- \.nf\ (converted to <nobr> ... </nobr> around each line)
- \.in ###\ (converted to <div style="margin-left: ###em;"> ... </div> around each line)
- \.ti ###\ (treated the same as \.in ###\ but only affects the current line, and the numeric value is added to the value provided by \.in ###\. See section 2.7 of the HL7 specification for more details.)
- \H\ (converted to <b>)
- \N\ (converted to </b>)
- Ampersands (&) are converted to their HTML equivalent (&)
- Chars over ASCII 160 are HTML encoded (e.g. Ç)
Note that the returned value from this method is an HTML snippet, not a complete HTML document.
- See Also:
-
getValueOrEmpty
Returns the value of the datatype as returned byAbstractPrimitive.getValue()but returns an empty string ("") if the value isnull. This method is mostly provided as a convenience in code which maps from one format to another, since it avoids the need for some null checks.
-