Class NamedDeserializer<T>

java.lang.Object
co.elastic.clients.json.NamedDeserializer<T>
All Implemented Interfaces:
JsonpDeserializer<T>

public class NamedDeserializer<T> extends Object implements JsonpDeserializer<T>
A deserializer that delegates to another deserializer provided as a JSON mapper attribute.
  • Constructor Details

    • NamedDeserializer

      public NamedDeserializer(String name)
  • Method Details

    • nativeEvents

      public EnumSet<jakarta.json.stream.JsonParser.Event> nativeEvents()
      Description copied from interface: JsonpDeserializer
      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.
      Specified by:
      nativeEvents in interface JsonpDeserializer<T>
    • acceptedEvents

      public EnumSet<jakarta.json.stream.JsonParser.Event> acceptedEvents()
      Description copied from interface: JsonpDeserializer
      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).
      Specified by:
      acceptedEvents in interface JsonpDeserializer<T>
    • deserialize

      public T deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper)
      Description copied from interface: JsonpDeserializer
      Deserialize a value. The value starts at the next state in the JSON stream.

      Default implementation delegates to JsonpDeserializer.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.

      Specified by:
      deserialize in interface JsonpDeserializer<T>
      Parameters:
      parser - the JSON parser
      mapper - the JSON-P mapper
      Returns:
      the parsed value or null
    • deserialize

      public T deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)
      Description copied from interface: JsonpDeserializer
      Deserialize a value. The value starts at the current state in the JSON stream.
      Specified by:
      deserialize in interface JsonpDeserializer<T>
      Parameters:
      parser - the JSON parser
      mapper - the JSON-P mapper
      event - the current state of parser, which must be part of JsonpDeserializer.acceptedEvents()
      Returns:
      the parsed value