Package ratpack.core.parse
Class Parse<T,O>
- java.lang.Object
-
- ratpack.core.parse.Parse<T,O>
-
- Type Parameters:
T
- the type of object to construct from the request bodyO
- the type of object that provides options/configuration for the parsing
public class Parse<T,O> extends Object
The specification of a particular parse.Construct instances via the
of(com.google.common.reflect.TypeToken<T>, O)
methods.- See Also:
Context.parse(Parse)
,Parser
,ParserSupport
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<O>
getOpts()
The type of object that provides options/configuration for the parsing.com.google.common.reflect.TypeToken<T>
getType()
The type of object to construct from the request body.static <T> Parse<T,?>
of(com.google.common.reflect.TypeToken<T> type)
Creates a parse object, with no options.static <T,O>
Parse<T,O>of(com.google.common.reflect.TypeToken<T> type, O opts)
Creates a parse object.static <T> Parse<T,?>
of(Class<T> type)
Creates a parse object, with no options.static <T,O>
Parse<T,O>of(Class<T> type, O opts)
Creates a parse object.
-
-
-
Method Detail
-
getType
public com.google.common.reflect.TypeToken<T> getType()
The type of object to construct from the request body.- Returns:
- the type of object to construct from the request body
-
getOpts
public Optional<O> getOpts()
The type of object that provides options/configuration for the parsing.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.
- Returns:
- the type of object that provides options/configuration for the parsing
-
of
public static <T,O> Parse<T,O> of(com.google.common.reflect.TypeToken<T> type, O opts)
Creates a parse object.- Type Parameters:
T
- the type of object to construct from the request bodyO
- the type of object that provides options/configuration for the parsing- Parameters:
type
- the type of object to construct from the request bodyopts
- the options object- Returns:
- a parse instance from the given arguments
-
of
public static <T> Parse<T,?> of(com.google.common.reflect.TypeToken<T> type)
Creates a parse object, with no options.- Type Parameters:
T
- the type of object to construct from the request body- Parameters:
type
- the type of object to construct from the request body- Returns:
- a parse instance to the given type
-
of
public static <T,O> Parse<T,O> of(Class<T> type, O opts)
Creates a parse object.- Type Parameters:
T
- the type of object to construct from the request bodyO
- the type of object that provides options/configuration for the parsing- Parameters:
type
- the type of object to construct from the request bodyopts
- the options object- Returns:
- a parse instance from the given arguments
-
-