O
- the type of option object this parser acceptspublic interface Parser<O>
Parsers power the Context.parse(Parse)
mechanism.
The ParserSupport
class is a convenient base; the documentation of which contains implementation examples.
Parse
,
ParserSupport
,
NoOptParserSupport
,
Context.parse(Parse)
Modifier and Type | Method and Description |
---|---|
java.lang.Class<O> |
getOptsType()
The type of option object that this parser accepts.
|
<T> T |
parse(Context context,
TypedData requestBody,
Parse<T,O> parse)
Deserializes the request body of the context into an object.
|
java.lang.Class<O> getOptsType()
ParserSupport
@Nullable <T> T parse(Context context, TypedData requestBody, Parse<T,O> parse) throws java.lang.Exception
T
- the type of object to construct from the request bodycontext
- The context to deserializerequestBody
- The request body to deserializeparse
- The description of how to parse the request bodynull
if this parser cannot parse to the requested typejava.lang.Exception
- if an error occurs parsing the request