Interface YassonJsonb

  • All Superinterfaces:
    java.lang.AutoCloseable, javax.json.bind.Jsonb
    All Known Implementing Classes:
    JsonBinding

    public interface YassonJsonb
    extends javax.json.bind.Jsonb
    Adds methods to Jsonb that are operating directly with JsonGenerator or JsonParser types.

    JsonProvider operates on top of the InputStream / OutputStream or Reader / Writer and creates generator / parser instances during runtime.

    This interface accepts instantiated generators and parsers with different input / output sources.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T fromJson​(javax.json.stream.JsonParser jsonParser, java.lang.Class<T> type)
      Reads in a JSON data with a specified JsonParser and return the resulting content tree.
      <T> T fromJson​(javax.json.stream.JsonParser jsonParser, java.lang.reflect.Type runtimeType)
      Reads in a JSON data with a specified JsonParser and return the resulting content tree.
      <T> T fromJsonStructure​(javax.json.JsonStructure jsonStructure, java.lang.Class<T> type)
      Reads a JsonStructure and and converts it into resulting java content tree.
      <T> T fromJsonStructure​(javax.json.JsonStructure jsonStructure, java.lang.reflect.Type runtimeType)
      Reads a JsonStructure and and converts it into resulting java content tree.
      void toJson​(java.lang.Object object, java.lang.reflect.Type runtimeType, javax.json.stream.JsonGenerator jsonGenerator)
      Writes the object content tree with a specified JsonGenerator.
      void toJson​(java.lang.Object object, javax.json.stream.JsonGenerator jsonGenerator)
      Writes the object content tree with a specified JsonGenerator.
      javax.json.JsonStructure toJsonStructure​(java.lang.Object object)
      Serializes the object content tree to a JsonStructure.
      javax.json.JsonStructure toJsonStructure​(java.lang.Object object, java.lang.reflect.Type runtimeType)
      Serializes the object content tree to a JsonStructure.
      • Methods inherited from interface java.lang.AutoCloseable

        close
      • Methods inherited from interface javax.json.bind.Jsonb

        fromJson, fromJson, fromJson, fromJson, fromJson, fromJson, toJson, toJson, toJson, toJson, toJson, toJson
    • Method Detail

      • fromJson

        <T> T fromJson​(javax.json.stream.JsonParser jsonParser,
                       java.lang.Class<T> type)
                throws javax.json.bind.JsonbException
        Reads in a JSON data with a specified JsonParser and return the resulting content tree. Provided json parser must be fully initialized, no further configurations will be applied.
        Type Parameters:
        T - Type of the content tree's root object.
        Parameters:
        jsonParser - The json parser instance to be used to read JSON data.
        type - Type of the content tree's root object.
        Returns:
        the newly created root object of the java content tree
        Throws:
        javax.json.bind.JsonbException - If any unexpected error(s) occur(s) during deserialization.
      • fromJson

        <T> T fromJson​(javax.json.stream.JsonParser jsonParser,
                       java.lang.reflect.Type runtimeType)
                throws javax.json.bind.JsonbException
        Reads in a JSON data with a specified JsonParser and return the resulting content tree. Provided json parser must be fully initialized, no further configurations will be applied.
        Type Parameters:
        T - Type of the content tree's root object.
        Parameters:
        jsonParser - The json parser instance to be used to read JSON data.
        runtimeType - Runtime type of the content tree's root object.
        Returns:
        the newly created root object of the java content tree
        Throws:
        javax.json.bind.JsonbException - If any unexpected error(s) occur(s) during deserialization.
      • fromJsonStructure

        <T> T fromJsonStructure​(javax.json.JsonStructure jsonStructure,
                                java.lang.Class<T> type)
                         throws javax.json.bind.JsonbException
        Reads a JsonStructure and and converts it into resulting java content tree.
        Type Parameters:
        T - Type of the content tree's root object.
        Parameters:
        jsonStructure - JsonStructure to be used as a source for conversion.
        type - Type of the content tree's root object.
        Returns:
        the newly created root object of the java content tree
        Throws:
        javax.json.bind.JsonbException - If any unexpected error(s) occur(s) during conversion.
      • fromJsonStructure

        <T> T fromJsonStructure​(javax.json.JsonStructure jsonStructure,
                                java.lang.reflect.Type runtimeType)
                         throws javax.json.bind.JsonbException
        Reads a JsonStructure and and converts it into resulting java content tree.
        Type Parameters:
        T - Type of the content tree's root object.
        Parameters:
        jsonStructure - JsonStructure to be used as a source for conversion.
        runtimeType - Runtime type of the content tree's root object.
        Returns:
        the newly created root object of the java content tree
        Throws:
        javax.json.bind.JsonbException - If any unexpected error(s) occur(s) during deserialization.
      • toJson

        void toJson​(java.lang.Object object,
                    javax.json.stream.JsonGenerator jsonGenerator)
             throws javax.json.bind.JsonbException
        Writes the object content tree with a specified JsonGenerator. Provided json generator must be fully initialized, no further configurations are applied.
        Parameters:
        object - The object content tree to be serialized.
        jsonGenerator - The json generator to write JSON data. The generator is not closed on a completion for further interaction.
        Throws:
        javax.json.bind.JsonbException - If any unexpected problem occurs during the serialization.
        Since:
        JSON Binding 1.0
      • toJson

        void toJson​(java.lang.Object object,
                    java.lang.reflect.Type runtimeType,
                    javax.json.stream.JsonGenerator jsonGenerator)
             throws javax.json.bind.JsonbException
        Writes the object content tree with a specified JsonGenerator. Provided json generator must be fully initialized, no further configurations are applied.
        Parameters:
        object - The object content tree to be serialized.
        runtimeType - Runtime type of the content tree's root object.
        jsonGenerator - The json generator to write JSON data. The generator is not closed on a completion for further interaction.
        Throws:
        javax.json.bind.JsonbException - If any unexpected problem occurs during the serialization.
        Since:
        JSON Binding 1.0
      • toJsonStructure

        javax.json.JsonStructure toJsonStructure​(java.lang.Object object)
                                          throws javax.json.bind.JsonbException
        Serializes the object content tree to a JsonStructure.
        Parameters:
        object - The object content tree to be serialized.
        Returns:
        The JsonStructure serialized from java content tree.
        Throws:
        javax.json.bind.JsonbException - If any unexpected problem occurs during the serialization.
        Since:
        JSON Binding 1.0
      • toJsonStructure

        javax.json.JsonStructure toJsonStructure​(java.lang.Object object,
                                                 java.lang.reflect.Type runtimeType)
                                          throws javax.json.bind.JsonbException
        Serializes the object content tree to a JsonStructure.
        Parameters:
        object - The object content tree to be serialized.
        runtimeType - Runtime type of the content tree's root object.
        Returns:
        The JsonStructure serialized from java content tree.
        Throws:
        javax.json.bind.JsonbException - If any unexpected problem occurs during the serialization.
        Since:
        JSON Binding 1.0