X12Simple¶
-
public class
X12Simpleimplements EDI, Iterable<Segment>¶ The X12 class is the object representation of an ANSI X12 transaction. The building block of an X12 transaction is an element. Some elements may be made of sub elements. Elements combine to form segments. Segments are grouped as loops. And a set of loops form an X12 transaction.
Author: Prasad Balan
Constructors¶
Methods¶
addSegment¶
addSegment¶
-
public Segment
addSegment(String segment)¶ Takes a
java.lang.Stringrepresentation of segment, creates aSegmentobject and adds the segment to the end of the X12 transaction.Parameters: - segment –
java.lang.Stringrepresentation of theSegment.
Returns: a new
Segmentobject- segment –
addSegment¶
addSegment¶
-
public Segment
addSegment(int index)¶ Creates an empty instance of
Segmentand inserts the segment at the specified position in the X12 transaction. The returned instance can be used to add elements to the segment.Parameters: - index – position at which to add the segment.
Returns: a new Segment object
addSegment¶
-
public Segment
addSegment(int index, String segment)¶ Takes a
java.lang.Stringrepresentation of segment, creates aSegmentobject and inserts the segment at the specified positionParameters: - segment –
java.lang.Stringrepresentation of theSegment. - index – a int.
Returns: a new
Segmentobject- segment –
addSegment¶
-
public Segment
addSegment(int index, Segment segment)¶ Takes a
java.lang.Stringrepresentation of segment, creates aSegmentobject and inserts the segment at the specified positionParameters: - segment –
java.lang.Stringrepresentation of the Segment. - index – a int.
Returns: a new Segment object
- segment –
findSegment¶
getContext¶
getSegment¶
getSegments¶
-
public List<Segment>
getSegments()¶ Returns the
java.util.List<Segment>.Returns: List of segments
iterator¶
-
public Iterator<Segment>
iterator()¶ Returns and
java.util.Iterator<java.lang.String> to the elements in the segment.Returns: java.util.Iterator<java.lang.String>
removeSegment¶
setContext¶
setSegment¶
setSegment¶
-
public Segment
setSegment(int index, String segment)¶ Takes a
java.lang.Stringrepresentation of segment, creates aSegmentobject and replaces the segment at the specified position in the X12 transaction.Parameters: - index – position of the segment to be replaced.
- segment –
java.lang.Stringrepresentation of the Segment.
Returns: a new Segment object
setSegment¶
toString¶
-
public String
toString()¶ Returns the X12 transaction in
java.lang.Stringformat. This method is used to convert the X12 object into a X12 transaction.Returns: a java.lang.Stringobject.
toString¶
toXML¶
toXML¶
-
public String
toXML(boolean bRemoveTrailingEmptyElements)¶ Returns the X12 transaction in XML format. This method translates the X12 object into XML format.
Parameters: - bRemoveTrailingEmptyElements – a flag for whether or not empty trailing elements should be removed.
Returns: the X12 as an XML string.