java.lang.Object
cl.netswitch.iso.amex8583.AmexYamlWriter<M>
- Type Parameters:
M
- the type of the message.
- All Implemented Interfaces:
AmexWriter<M>
Converts a message of AMEX fields to a YAML representation.
-
Constructor Summary
ConstructorDescriptionConstructs a newAmexYamlWriter
instance.AmexYamlWriter
(int capacity) Constructs a newAmexYamlWriter
instance with capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoid
closeGroup
(String name) Marks the end of a group of fields or properties.Marks the beginning of group of fields or properties.void
reset()
Reset this writer so it can be reused again.toString()
Returns the YAML string built using this writer.void
writeField
(AmexField<M, ?> field, M message) Writes a field and the value it contains in message.void
writeProperty
(AmexField<?, ?> field, String name, Object value, String comment) Writes the name and value of a field property.void
writeValue
(AmexField<?, ?> field, Object value) Writes the value of a field or field property.
-
Constructor Details
-
AmexYamlWriter
public AmexYamlWriter()Constructs a newAmexYamlWriter
instance. -
AmexYamlWriter
public AmexYamlWriter(int capacity) Constructs a newAmexYamlWriter
instance with capacity.- Parameters:
capacity
- the initial capacity of this writer.- Throws:
NegativeArraySizeException
- ifcapacity
is negative.
-
-
Method Details
-
toString
Returns the YAML string built using this writer. -
openGroup
Marks the beginning of group of fields or properties. The group must be closed later callingcloseGroup
with the returned group name, which may not be the same as the supplied argument.- Specified by:
openGroup
in interfaceAmexWriter<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
Marks the end of a group of fields or properties. The group must have been opened before callingopenGroup
using the samename
.- Specified by:
closeGroup
in interfaceAmexWriter<M>
- Parameters:
name
- the optional name of the group (can be null).- See Also:
-
writeField
Writes a field and the value it contains in message.- Specified by:
writeField
in interfaceAmexWriter<M>
- Parameters:
field
- the field to be written.message
- the message that contains the field value.- Throws:
NullPointerException
- if an argument isnull
.
-
writeProperty
Writes the name and value of a field property.- Specified by:
writeProperty
in interfaceAmexWriter<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 isnull
.
-
writeValue
Writes the value of a field or field property.- Specified by:
writeValue
in interfaceAmexWriter<M>
- Parameters:
field
- the field that contains the value.value
- the value of the field or property (can be null).- Throws:
NullPointerException
- iffield
isnull
.
-
reset
public void reset()Reset this writer so it can be reused again.- Specified by:
reset
in interfaceAmexWriter<M>
-