Interface VipWriter<M>

Type Parameters:
M - the type of the message.
All Known Implementing Classes:
VipJsonWriter, VipXmlWriter, VipYamlWriter

public interface VipWriter<M>
Converts a message of VIP fields to an another representation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Marks the end of a group of fields or properties.
    Marks the beginning of group of fields or properties.
    void
    Reset this writer so it can be reused again.
    void
    writeField(VipField<M,?> field, M message)
    Writes a field and the value it contains in message.
    void
    writeProperty(VipField<?,?> field, String name, Object value, String comment)
    Writes the name and value of a field property.
    void
    writeValue(VipField<?,?> field, Object value)
    Writes the value of a field or field property.
  • Method Details

    • openGroup

      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.
      Parameters:
      name - the optional name of the group (can be null).
      Returns:
      the group name to use when closing the group.
      See Also:
    • closeGroup

      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.
      Parameters:
      name - the optional name of the group (can be null).
      See Also:
    • writeField

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

      void writeProperty(VipField<?,?> field, String name, Object value, String comment)
      Writes the name and value of a field property.
      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

      void writeValue(VipField<?,?> field, Object value)
      Writes the value of a field or field property.
      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

      void reset()
      Reset this writer so it can be reused again.