Class JsonInputConverter<T>

  • Type Parameters:
    T - the type of the object to convert the JSON Object into
    All Implemented Interfaces:

    public class JsonInputConverter<T>
    extends InputStreamInputConverter<T>
    An InputConverter that converts a JSON Object read from an InputStream into an object. The actual conversion from JSON to an object is handled by an instance of JsonConverter.
    • Constructor Detail

      • JsonInputConverter

        public JsonInputConverter​(Class<T> targetClass)
        Construct a new instance of a JsonInputConverter that is able to convert the data read from the InputStream into objects of the specified targetClass.
        targetClass - The class defining the objects being converted from JSON.
    • Method Detail

      • read

        public T read()
        Converts a JSON Object that is read from the InputStream into an object and returns it. If the specified targetClass in the constructor equals to JsonObject.class, then this method will just return the read JSON object directly instead of running the conversion. Otherwise, a JsonConverter will be used to convert the JSON Object into the final object to return.
        An object converted from the JSON Object that was read from the InputStream.