Class ISODataset

java.lang.Object
org.jpos.iso.ISODataset
All Implemented Interfaces:
Dataset

public class ISODataset extends Object implements Dataset
Mutable dataset implementation used by ISODatasetField.
  • Constructor Details

    • ISODataset

      public ISODataset(int identifier, DatasetFormat format)
      Creates an empty dataset.
      Parameters:
      identifier - dataset identifier
      format - dataset format
  • Method Details

    • getIdentifier

      public int getIdentifier()
      Description copied from interface: Dataset
      Returns the dataset identifier as carried on the wire.
      Specified by:
      getIdentifier in interface Dataset
      Returns:
      dataset identifier in the range 0x01 to 0xFE
    • getFormat

      Description copied from interface: Dataset
      Returns the logical dataset encoding format.
      Specified by:
      getFormat in interface Dataset
      Returns:
      dataset format
    • addElement

      public void addElement(DatasetElement element)
      Appends an element without replacing existing entries with the same id.
      Parameters:
      element - element to append
    • putElement

      public void putElement(DatasetElement element)
      Replaces any existing elements with the same id and then appends the supplied element.
      Parameters:
      element - element to store
    • addElement

      public void addElement(int id, ISOComponent component)
      Appends a primitive element.
      Parameters:
      id - element identifier
      component - backing component
    • putElement

      public void putElement(int id, ISOComponent component)
      Replaces any existing element with the same id.
      Parameters:
      id - element identifier
      component - backing component
    • addElement

      public void addElement(int id, ISOComponent component, boolean constructed)
      Appends an element and records its constructed TLV flag.
      Parameters:
      id - element identifier
      component - backing component
      constructed - whether the tag is constructed
    • putElement

      public void putElement(int id, ISOComponent component, boolean constructed)
      Replaces any existing element with the same id and records its constructed TLV flag.
      Parameters:
      id - element identifier
      component - backing component
      constructed - whether the tag is constructed
    • removeElement

      public void removeElement(int id)
      Removes all elements that match the supplied identifier.
      Parameters:
      id - element identifier to remove
    • isEmpty

      public boolean isEmpty()
      Indicates whether the dataset contains any elements.
      Returns:
      true when empty
    • with

      public ISODataset with(int id, String value)
      Stores a character element and returns this dataset for fluent chaining.
      Parameters:
      id - element identifier
      value - element value
      Returns:
      this dataset
    • with

      public ISODataset with(int id, byte[] value)
      Stores a binary element and returns this dataset for fluent chaining.
      Parameters:
      id - element identifier
      value - element value
      Returns:
      this dataset
    • with

      public ISODataset with(int id, ISOComponent component)
      Stores an ISO component and returns this dataset for fluent chaining.
      Parameters:
      id - element identifier
      component - backing component
      Returns:
      this dataset
    • with

      public ISODataset with(int id, ISOComponent component, boolean constructed)
      Stores an ISO component and its constructed TLV flag, returning this dataset for fluent chaining.
      Parameters:
      id - element identifier
      component - backing component
      constructed - whether the tag is constructed
      Returns:
      this dataset
    • getElements

      Description copied from interface: Dataset
      Returns all decoded elements in insertion order.
      Specified by:
      getElements in interface Dataset
      Returns:
      immutable list of dataset elements
    • getElements

      public List<DatasetElement> getElements(int id)
      Description copied from interface: Dataset
      Returns all elements that match the supplied element identifier.
      Specified by:
      getElements in interface Dataset
      Parameters:
      id - element identifier, either a TLV tag or DBM bit number
      Returns:
      immutable list of matching elements
    • getElement

      public DatasetElement getElement(int id)
      Description copied from interface: Dataset
      Returns the first element that matches the supplied identifier.
      Specified by:
      getElement in interface Dataset
      Parameters:
      id - element identifier, either a TLV tag or DBM bit number
      Returns:
      matching element or null when absent
    • getComponent

      public ISOComponent getComponent(int id)
      Returns the ISOComponent of the first matching element.
      Parameters:
      id - element identifier
      Returns:
      matching component, or null if no element has the given id
    • getValue

      public Object getValue(int id) throws ISOException
      Returns the logical value of the first matching element.
      Parameters:
      id - element identifier
      Returns:
      element value or null
      Throws:
      ISOException - on component access errors
    • getBytes

      public byte[] getBytes(int id) throws ISOException
      Returns the bytes of the first matching element.
      Parameters:
      id - element identifier
      Returns:
      element bytes or null
      Throws:
      ISOException - on component access errors