Class AmexXmlWriter<M>

java.lang.Object
cl.netswitch.iso.amex8583.AmexXmlWriter<M>
Type Parameters:
M - the type of the message.
All Implemented Interfaces:
AmexWriter<M>

public class AmexXmlWriter<M> extends Object implements AmexWriter<M>
Converts a message of AMEX fields to an XML representation.
  • Constructor Details

    • AmexXmlWriter

      public AmexXmlWriter()
      Constructs a new AmexXmlWriter instance.
    • AmexXmlWriter

      public AmexXmlWriter(int capacity)
      Constructs a new AmexXmlWriter instance with capacity.
      Parameters:
      capacity - the initial capacity of this writer.
      Throws:
      NegativeArraySizeException - if capacity is negative.
  • Method Details

    • toString

      public String toString()
      Returns the string generated with this writer.
      Overrides:
      toString in class Object
      Returns:
      the string generated with this writer.
    • openGroup

      public String openGroup(String name)
      Marks the beginning of group of fields or properties. The group must be closed later calling closeGroup with the returned group name, which may not be the same as the supplied argument.
      Specified by:
      openGroup in interface AmexWriter<M>
      Parameters:
      name - the optional name of the group (can be null).
      Returns:
      the group name to use when closing the group.
      See Also:
    • closeGroup

      public void closeGroup(String name)
      Marks the end of a group of fields or properties. The group must have been opened before calling openGroup using the same name.
      Specified by:
      closeGroup in interface AmexWriter<M>
      Parameters:
      name - the optional name of the group (can be null).
      See Also:
    • writeField

      public void writeField(AmexField<M,?> field, M message)
      Writes a field and the value it contains in message.
      Specified by:
      writeField in interface AmexWriter<M>
      Parameters:
      field - the field to be written.
      message - the message that contains the field value.
      Throws:
      NullPointerException - if an argument is null.
    • writeProperty

      public void writeProperty(AmexField<?,?> field, String name, Object value, String comment)
      Writes the name and value of a field property.
      Specified by:
      writeProperty in interface AmexWriter<M>
      Parameters:
      field - the field that contains the property.
      name - the name of the property of the field.
      value - the value of the field property (can be null).
      comment - a description of the property (can be null).
      Throws:
      NullPointerException - if an argument is null.
    • writeValue

      public void writeValue(AmexField<?,?> field, Object value)
      Writes the value of a field or field property.
      Specified by:
      writeValue in interface AmexWriter<M>
      Parameters:
      field - the field that contains the value.
      value - the value of the field or property (can be null).
      Throws:
      NullPointerException - if field is null.
    • reset

      public void reset()
      Reset this writer so it can be reused again.
      Specified by:
      reset in interface AmexWriter<M>