Class AbstractDataObject

    • Constructor Detail

      • AbstractDataObject

        public AbstractDataObject()
    • Method Detail

      • writeContent

        public final void writeContent​(JsonWriter out)
                                throws IOException
        Description copied from interface: DataObject
        Writes a JSON object containing keys for all fields of this object.

        In contrast to DataObject.writeTo(JsonWriter), the resulting object contains no type information. Therefore, this method must only be called directly, if the reader knows the type of the object to read from the context. For reading the data, a per-type generated read[type-name]() method must be called.

        Specified by:
        writeContent in interface DataObject
        Parameters:
        out - The writer to write to.
        Throws:
        IOException
      • writeFields

        protected void writeFields​(JsonWriter out)
                            throws IOException
        Writes all fields of this instance to the given output.
        Parameters:
        out - The writer to write to.
        Throws:
        IOException - If writing fails.
      • readContent

        public final void readContent​(JsonReader in)
                               throws IOException
        Description copied from interface: DataObject
        Reads a JSON object containing keys for all fields of this object.

        This method does not consider type information contained in the stream.

        Specified by:
        readContent in interface DataObject
        Parameters:
        in - The writer to write to.
        Throws:
        IOException
      • readFields

        protected final void readFields​(JsonReader in)
                                 throws IOException
        Reads all fields of this instance from the given input.
        Parameters:
        in - The reader to take the input from.
        Throws:
        IOException
      • readField

        protected void readField​(JsonReader in,
                                 String field)
                          throws IOException
        Reads the given field from the given input.
        Parameters:
        in - The reader to take the value from.
        field - The name of the field whose value should be read.
        Throws:
        IOException