org.urhl7.igor
Class HL7Field

java.lang.Object
  extended by org.urhl7.igor.HL7Field
All Implemented Interfaces:
DataField, DelimitedStructure, GenericStructure

public class HL7Field
extends Object
implements GenericStructure, DataField, DelimitedStructure

HL7Field is a data object that represents the discrete field portions of an HL7 message.


Constructor Summary
HL7Field(char[] delims)
          Creates a HL7Field object that understands the specified delimiters.
HL7Field(HL7RepeatingField parent)
          Creates a HL7Field object that understands the specified delimiters of the parent, as well as references it's parent.
 
Method Summary
 boolean addFieldComponent(HL7FieldComponent fieldcomp)
          Adds a HL7FieldComponent to the end of the underlying list structure.
 void addFieldComponent(int index, HL7FieldComponent fieldcomp)
          Adds a HL7FieldComponent to the underlying list structure at the specified index.
 void changeDelims(char[] chars)
          Changes the internal delimiters for this field
 String getData()
          Retrieve the underlying data for this data object.
 char[] getDelims()
          Returns the delimiter set for this data object.
 HL7FieldComponent getFieldComponent(int pos)
          Returns a specific HL7FieldComponent as the provided index for the underlying list structure.
 List<HL7FieldComponent> getFieldComponents()
          Return the underlying list structure of all field components associated with this field.
 HL7RepeatingField getParent()
          Returns a reference to the parent HL7RepeatingField for this HL7Field
 boolean isBaseField()
          Returns if this field is the base field, or if it has subfields included.
 String marshal()
          Returns a string representation of this and the underlying data structures
 boolean removeFieldComponent(HL7FieldComponent fieldcomp)
          Remove a particular HL7FieldComponent from the underlying list data structure
 HL7FieldComponent removeFieldComponent(int pos)
          Removes a particular HL7FieldComponent at a particular index position for the underlying list data structure.
 void setData(String data)
          Set the underlying data for this data object.
 HL7FieldComponent setFieldComponent(int pos, HL7FieldComponent fieldcomp)
          Replaces a HL7FieldComponent at a position with the provided HL7FieldComponent
 void setParent(HL7RepeatingField parent)
          Sets the parent of this HL7Field to a HL7RepeatingField
 String toString()
          Returns a String representation of this field
 void unmarshal(String data)
          Unmarshals an arbitrary String representation of a structure into this data structure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HL7Field

public HL7Field(char[] delims)
Creates a HL7Field object that understands the specified delimiters.

Parameters:
delims - delimiter set to use

HL7Field

public HL7Field(HL7RepeatingField parent)
Creates a HL7Field object that understands the specified delimiters of the parent, as well as references it's parent.

Parameters:
parent - reference to parent
Method Detail

getParent

public HL7RepeatingField getParent()
Returns a reference to the parent HL7RepeatingField for this HL7Field

Returns:
the parent

setParent

public void setParent(HL7RepeatingField parent)
Sets the parent of this HL7Field to a HL7RepeatingField

Parameters:
parent - the parent to set

marshal

public String marshal()
Returns a string representation of this and the underlying data structures

Specified by:
marshal in interface GenericStructure
Returns:
a String representation of this structure

unmarshal

public void unmarshal(String data)
Unmarshals an arbitrary String representation of a structure into this data structure

Specified by:
unmarshal in interface GenericStructure
Parameters:
data - a String representation of data

changeDelims

public void changeDelims(char[] chars)
Changes the internal delimiters for this field

Specified by:
changeDelims in interface DelimitedStructure
Parameters:
chars - the delimiters

toString

public String toString()
Returns a String representation of this field

Overrides:
toString in class Object
Returns:
a string representation

getDelims

public char[] getDelims()
Returns the delimiter set for this data object.

Specified by:
getDelims in interface DelimitedStructure
Returns:
delimiter array

isBaseField

public boolean isBaseField()
Returns if this field is the base field, or if it has subfields included.

Returns:
the baseField

setData

public void setData(String data)
Set the underlying data for this data object.

Specified by:
setData in interface DataField
Parameters:
data - a String representation of the data

getData

public String getData()
Retrieve the underlying data for this data object.

Specified by:
getData in interface DataField
Returns:
String representation of the data

getFieldComponents

public List<HL7FieldComponent> getFieldComponents()
Return the underlying list structure of all field components associated with this field.

Returns:
List of HL7FieldComponents

getFieldComponent

public HL7FieldComponent getFieldComponent(int pos)
Returns a specific HL7FieldComponent as the provided index for the underlying list structure.

Parameters:
pos - the index you wish you use
Returns:
the HL7FieldComponent at this position.

addFieldComponent

public boolean addFieldComponent(HL7FieldComponent fieldcomp)
Adds a HL7FieldComponent to the end of the underlying list structure.

Parameters:
fieldcomp - the HL7FieldComponent to add
Returns:
the success of the addition.

addFieldComponent

public void addFieldComponent(int index,
                              HL7FieldComponent fieldcomp)
Adds a HL7FieldComponent to the underlying list structure at the specified index. Data beyond the specified index will be shifted one position over.

Parameters:
index - the index to insert the HL7FieldComponent at for the underlying data list.
fieldcomp - the HL7FieldComponent to add.

removeFieldComponent

public HL7FieldComponent removeFieldComponent(int pos)
Removes a particular HL7FieldComponent at a particular index position for the underlying list data structure.

Parameters:
pos - the index to remove
Returns:
the removed HL7FieldComponent (with parent reference removed)

removeFieldComponent

public boolean removeFieldComponent(HL7FieldComponent fieldcomp)
Remove a particular HL7FieldComponent from the underlying list data structure

Parameters:
fieldcomp - the HL7FieldComponent to remove
Returns:
success of the removal (with parent reference removed)

setFieldComponent

public HL7FieldComponent setFieldComponent(int pos,
                                           HL7FieldComponent fieldcomp)
Replaces a HL7FieldComponent at a position with the provided HL7FieldComponent

Parameters:
pos - index to replace
fieldcomp - HL7FieldComponent to replace with
Returns:
the previous HL7FieldComponent with parent references removed.