public final class HL7Field extends Object implements Serializable
Instances of this class are "immutable"; however, for this to be true the calling application must not alter the arrays passed to the constructor or returned from any of the methods.
| Modifier and Type | Field and Description |
|---|---|
static HL7Field |
EMPTY
The empty field.
|
protected String[][][] |
value |
| Constructor and Description |
|---|
HL7Field(HL7Field field)
Copy constructor.
|
HL7Field(String value)
Constructor.
|
HL7Field(String[] repeats)
Constructor used to create a field containing zero or more repeated values, each a simple string value.
|
HL7Field(String[][][] repeats)
Constructor used to create a field containing zero or more repeated values, each containing zero or more components,
each component containing zero or more sub-components.
|
HL7Field(String field,
HL7Seps seps)
Parsing constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(StringBuilder buf,
HL7Seps seps)
Append properly separated and escaped version of this field
to the given buffer.
|
boolean |
equals(Object obj) |
String |
get(int repnum,
int compnum,
int subnum)
Get a specific field sub-component.
|
String[][][] |
getValue()
Get field contents.
|
int |
hashCode() |
boolean |
isEmpty() |
String |
toString()
Convert to a string using
HL7Seps.DEFAULT. |
String |
toString(HL7Seps seps)
Convert to a string using the provided separators.
|
public static final HL7Field EMPTY
protected final String[][][] value
public HL7Field(String value)
value - simple string value for this field; null is treated like the empty stringpublic HL7Field(String[] repeats)
Note: the repeats array is not copied by this constructor, so the caller should not modify the array.
repeats - repeat values for this field; null is treated like the empty stringIllegalArgumentException - if repeats array has length zeropublic HL7Field(String[][][] repeats)
Note: the repeats array is not copied by this constructor, so the caller should not modify the array.
repeats - repeat array, each containing a component array, each containing a sub-component array; null in any
String position is treated like the empty stringNullPointerException - if any intermediate array element (i.e., not of type String) is nullIllegalArgumentException - if repeats array or any sub-array has length zeropublic HL7Field(String field, HL7Seps seps)
Parses the encoded HL7 field. Non-custom escapes will be decoded, while custom escapes will be silently removed.
field - encoded HL7 field contentsseps - HL7 separator characterspublic HL7Field(HL7Field field)
This constructor performs a deep copy of field, so that subsequent changes to it do not affect this instance.
field - field to copypublic String[][][] getValue()
The length of the returned array, each of its array elements, and each of their sub-array elements, is guaranteed to be at least one.
Note: the returned array is not a copy, so the caller should not modify it.
public boolean isEmpty()
public String get(int repnum, int compnum, int subnum)
repnum - repeat number (zero-based)compnum - component number (zero-based)subnum - sub-component number (zero-based)IllegalArgumentException - if any parameter is negativepublic void append(StringBuilder buf, HL7Seps seps)
buf - string bufferseps - HL7 separator and escape characterspublic String toString(HL7Seps seps)
seps - HL7 separator and escape characterssepspublic String toString()
HL7Seps.DEFAULT.Copyright © 2018. All rights reserved.