T - The type that this parser deserializes toP - The type of the parse objectpublic interface Parser<T,P extends Parse<T>>
Parses power the Context.parse(Parse) mechanism.
A parser works with requests of a given content type (as advertised by getContentType())
and with a particular type of Parse object (as advertised by getParseType()),
of a particular final parsed type (as advertised by getParsedType()).
The ParserSupport class is a convenient base, the documentation
of which contains implementation examples.
Parse,
ParserSupport,
Context.parse(Parse)| Modifier and Type | Method and Description |
|---|---|
String |
getContentType()
The content type that this parser knows how to deserialize.
|
Class<T> |
getParsedType()
The type that this parser can deserialize to.
|
Class<P> |
getParseType()
The type of the
Parse object for this parser. |
T |
parse(Context context,
TypedData requestBody,
P parse)
Deserializes the request body of the context into an object.
|
String getContentType()
Class<P> getParseType()
Parse object for this parser.Parse object for this parser.Class<T> getParsedType()
T parse(Context context, TypedData requestBody, P parse) throws Exception
context - The context to deserializerequestBody - The request body to deserializeparse - The description of how to parse the request bodyException - if an error occurs parsing the request