Interface ObjectEncoder

  • All Known Implementing Classes:
    BinaryObjectEncoder, XmlObjectEncoder

    public interface ObjectEncoder
    Interface to abstract away the difference between serializing xml and binary
    • Method Detail

      • writeObjectField

        void writeObjectField​(String fieldName,
                              Object object,
                              boolean inline)
        Writes an object using the appropriate serializer for that object
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the subelement name for xml serialization
        object - The object to serialize
        inline - Ignore for binary serialization. For xml serialization, this causes us not to have a sub-element. When inlining, polymorphic typing is not supported.
      • writeBooleanField

        void writeBooleanField​(String fieldName,
                               boolean v)
        Writes a boolean.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeIntField

        void writeIntField​(String fieldName,
                           int v)
        Writes an int.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeLongField

        void writeLongField​(String fieldName,
                            long v)
        Writes a long.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeFloatField

        void writeFloatField​(String fieldName,
                             float v)
        Writes a float.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeDoubleField

        void writeDoubleField​(String fieldName,
                              double v)
        Writes a double.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeClassField

        void writeClassField​(String fieldName,
                             Class<?> v)
        Writes a Class.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeStringField

        void writeStringField​(String fieldName,
                              String v)
        Writes a String.
        Parameters:
        fieldName - A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serialization
        v - The value to serialize
      • writeStringContents

        void writeStringContents​(String str)
        Writes the value in-line.
      • writeBooleanContents

        void writeBooleanContents​(boolean v)
        Writes the value in-line.
      • writeIntContents

        void writeIntContents​(int v)
        Writes the value in-line.
      • writeLongContents

        void writeLongContents​(long v)
        Writes the value in-line.
      • writeFloatContents

        void writeFloatContents​(float v)
        Writes the value in-line.
      • writeDoubleContents

        void writeDoubleContents​(double v)
        Writes the value in-line.
      • writeByteContents

        void writeByteContents​(byte v)
        Writes the value in-line.
      • writeByteArrayContents

        void writeByteArrayContents​(byte[] v)
        Special case for byte [] that uses base64 encoding for XML
      • writeClassContents

        void writeClassContents​(Class<?> v)
        Writes the value in-line.
      • writeObjectContents

        void writeObjectContents​(Object o)
        Writes a sub-object
        Parameters:
        o - The object to write