Interface JsonpDeserializer<V>

All Known Implementing Classes:
BuildFunctionDeserializer, DelegatingDeserializer, DelegatingDeserializer.SameType, ExternallyTaggedUnion.TypedKeysDeserializer, JsonEnum.Deserializer, JsonpDeserializerBase, NamedDeserializer, ObjectBuilderDeserializer, ObjectDeserializer, UnionDeserializer

public interface JsonpDeserializer<V>
  • Method Details

    • nativeEvents

      java.util.EnumSet<> nativeEvents()
      The native JSON events this deserializer accepts as a starting point. For example, native events for a boolean are JsonParser.Event.VALUE_TRUE and JsonParser.Event.VALUE_FALSE.
    • acceptedEvents

      java.util.EnumSet<> acceptedEvents()
      The JSON events this deserializer accepts as a starting point. For example, events for a boolean are JsonParser.Event.VALUE_TRUE, JsonParser.Event.VALUE_FALSE and JsonParser.Event.VALUE_STRING, the latter being converted to a boolean using Boolean.parseBoolean(String).
    • accepts

      default boolean accepts​( event)
      Convenience method for acceptedEvents().contains(event)
    • deserialize

      default V deserialize​( parser, JsonpMapper mapper)
      Deserialize a value. The value starts at the next state in the JSON stream.

      Default implementation delegates to deserialize(JsonParser, JsonpMapper, Event) after having checked that the next event is part of the accepted events.

      If the next event is JsonParser.Event.VALUE_NULL, null is returned unless JsonParser.Event.VALUE_NULL is part of the deserializer's accepted events.

      parser - the JSON parser
      mapper - the JSON-P mapper
      the parsed value or null
    • deserialize

      V deserialize​( parser, JsonpMapper mapper, event)
      Deserialize a value. The value starts at the current state in the JSON stream.
      parser - the JSON parser
      mapper - the JSON-P mapper
      event - the current state of parser, which must be part of acceptedEvents()
      the parsed value
    • of

      static <T> JsonpDeserializer<T> of​(java.lang.Class<T> clazz)
      Creates a deserializer for a class that delegates to the mapper provided to deserialize(JsonParser, JsonpMapper).
    • of

      static <T> JsonpDeserializer<T> of​(java.util.EnumSet<> acceptedEvents, java.util.function.BiFunction<,​JsonpMapper,​T> fn)
    • of

      static <T> JsonpDeserializer<T> of​(java.util.EnumSet<> acceptedEvents, TriFunction<,​JsonpMapper,​,​T> fn)
    • lazy

      static <T> JsonpDeserializer<T> lazy​(java.util.function.Supplier<JsonpDeserializer<T>> ctor)
    • fixedValue

      static <T> JsonpDeserializer<T> fixedValue​(T value)
    • emptyObject

      static <T> JsonpDeserializer<T> emptyObject​(T value)
    • stringDeserializer

      static JsonpDeserializer<java.lang.String> stringDeserializer()
    • integerDeserializer

      static JsonpDeserializer<java.lang.Integer> integerDeserializer()
    • booleanDeserializer

      static JsonpDeserializer<java.lang.Boolean> booleanDeserializer()
    • longDeserializer

      static JsonpDeserializer<java.lang.Long> longDeserializer()
    • floatDeserializer

      static JsonpDeserializer<java.lang.Float> floatDeserializer()
    • doubleDeserializer

      static JsonpDeserializer<java.lang.Double> doubleDeserializer()
    • doubleOrNullDeserializer

      static JsonpDeserializer<java.lang.Double> doubleOrNullDeserializer​(double defaultValue)
      A double deserializer that will return a default value when the JSON value is null
    • intOrNullDeserializer

      static JsonpDeserializer<java.lang.Integer> intOrNullDeserializer​(int defaultValue)
      An integer deserializer that will return a default value when the JSON value is null
    • numberDeserializer

      static JsonpDeserializer<java.lang.Number> numberDeserializer()
    • jsonValueDeserializer

      static JsonpDeserializer<jakarta.json.JsonValue> jsonValueDeserializer()
    • voidDeserializer

      static JsonpDeserializer<java.lang.Void> voidDeserializer()
    • arrayDeserializer

      static <T> JsonpDeserializer<java.util.List<T>> arrayDeserializer​(JsonpDeserializer<T> itemDeserializer)
    • stringMapDeserializer

      static <T> JsonpDeserializer<java.util.Map<java.lang.String,​T>> stringMapDeserializer​(JsonpDeserializer<T> itemDeserializer)
    • enumMapDeserializer

      static <K extends JsonEnum,​ V> JsonpDeserializer<java.util.Map<K,​V>> enumMapDeserializer​(JsonpDeserializer<K> keyDeserializer, JsonpDeserializer<V> valueDeserializer)