T
- the type of object to construct from the request bodyO
- the type of object that provides options/configuration for the parsingpublic class Parse<T,O>
extends java.lang.Object
Construct instances via the of(com.google.common.reflect.TypeToken<T>, O)
methods.
Context.parse(Parse)
,
Parser
,
ParserSupport
Modifier and Type | Method and Description |
---|---|
java.util.Optional<O> |
getOpts()
The type of object that provides options/configuration for the parsing.
|
TypeToken<T> |
getType()
The type of object to construct from the request body.
|
static <T> Parse<T,?> |
of(java.lang.Class<T> type)
Creates a parse object, with no options.
|
static <T,O> Parse<T,O> |
of(java.lang.Class<T> type,
O opts)
Creates a parse object.
|
static <T> Parse<T,?> |
of(TypeToken<T> type)
Creates a parse object, with no options.
|
static <T,O> Parse<T,O> |
of(TypeToken<T> type,
O opts)
Creates a parse object.
|
public TypeToken<T> getType()
public java.util.Optional<O> getOpts()
For any parse request, no options may be specified. Parser implementations should throw an exception if they require an options object when none is supplied.
public static <T,O> Parse<T,O> of(TypeToken<T> type, O opts)
T
- the type of object to construct from the request bodyO
- the type of object that provides options/configuration for the parsingtype
- the type of object to construct from the request bodyopts
- the options objectpublic static <T> Parse<T,?> of(TypeToken<T> type)
T
- the type of object to construct from the request bodytype
- the type of object to construct from the request bodypublic static <T,O> Parse<T,O> of(java.lang.Class<T> type, O opts)
T
- the type of object to construct from the request bodyO
- the type of object that provides options/configuration for the parsingtype
- the type of object to construct from the request bodyopts
- the options objectpublic static <T> Parse<T,?> of(java.lang.Class<T> type)
T
- the type of object to construct from the request bodytype
- the type of object to construct from the request body