Package org.opensearch.client.util
Class StringEnum.Deserializer<T extends java.lang.Enum<T> & StringEnum>
java.lang.Object
org.opensearch.client.json.JsonpDeserializer<T>
org.opensearch.client.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 Tdeserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)Parse a value.Tdeserialize(java.lang.String value, jakarta.json.stream.JsonParser parser)Get the enum member for a json string valueTparse(java.lang.String value)Get the enum member for a json string valueMethods inherited from class org.opensearch.client.json.JsonpDeserializer
acceptedEvents, accepts, allAcceptedEvents, arrayDeserializer, booleanDeserializer, deserialize, doubleDeserializer, ensureAccepts, fixedValue, floatParser, integerDeserializer, jsonValueDeserializer, lazy, lazy, longParser, numberDeserializer, of, stringDeserializer, stringMapDeserializer
-
Constructor Details
-
Method Details
-
deserialize
public T deserialize(jakarta.json.stream.JsonParser parser, JsonpMapper mapper, jakarta.json.stream.JsonParser.Event event)Description copied from class:JsonpDeserializerParse 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:
deserializein 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
-