Package co.elastic.clients.util
Class StringEnum.Deserializer<T extends java.lang.Enum<T> & StringEnum>
java.lang.Object
co.elastic.clients.json.JsonpDeserializer<T>
co.elastic.clients.util.StringEnum.Deserializer<T>
- Enclosing interface:
- StringEnum
public static class StringEnum.Deserializer<T extends java.lang.Enum<T> & StringEnum> extends JsonpDeserializer<T>
-
Constructor Summary
Constructors Constructor Description Deserializer(T[] values)
-
Method Summary
Modifier and Type Method Description T
deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)
Parse a value.T
deserialize(java.lang.String value, jakarta.json.stream.JsonParser parser)
Get the enum member for a json string valueT
parse(java.lang.String value)
Get the enum member for a json string valueMethods inherited from class co.elastic.clients.json.JsonpDeserializer
acceptedEvents, accepts, allAcceptedEvents, arrayDeserializer, booleanDeserializer, deserialize, doubleDeserializer, emptyObject, ensureAccepts, fixedValue, floatDeserializer, integerDeserializer, jsonValueDeserializer, lazy, lazy, lazy, lazyInstance, longDeserializer, numberDeserializer, of, of, of, stringDeserializer, stringMapDeserializer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Deserializer
-
-
Method Details
-
deserialize
public T deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)Description copied from class:JsonpDeserializer
Parse a value. The value starts at the current state in the json stream. This method will usually start withensureAccepts(parser, event)
to ensure correctness of the starting state.- Specified by:
deserialize
in classJsonpDeserializer<T extends java.lang.Enum<T> & StringEnum>
- Parameters:
parser
- the json parsermapper
- the jsonp mapperevent
- the current state ofparser
, which must be part ofJsonpDeserializer.acceptedEvents
- Returns:
- the parsed value
-
deserialize
Get the enum member for a json string value- Parameters:
value
- the json valueparser
- parsing context- Returns:
- the enum member
- Throws:
jakarta.json.stream.JsonParsingException
- if no matching enum was found
-
parse
Get the enum member for a json string value- Parameters:
value
- the json value- Returns:
- the enum member
- Throws:
java.lang.IllegalArgumentException
- if no matching enum was found
-