public interface Mutant
A type safe Mutant
useful for reading parameters and headers.
// str param String value = request.param("str").value(); // optional str String value = request.param("str").toOptional().orElse("defs"); // int param int value = request.param("some").intValue(); // optional int param Optional <Integer > value = request.param("some").toOptional(Integer.class); // list param List <String > values = request.param("some").toList(String.class); // file upload Upload upload = request.param("file").to(Upload.class);
Request.param(String)
,
Request.header(String)
Modifier and Type | Method and Description |
---|---|
default boolean |
booleanValue() |
default byte |
byteValue() |
default char |
charValue() |
default double |
doubleValue() |
default float |
floatValue() |
default int |
intValue() |
boolean |
isPresent() |
default long |
longValue() |
default short |
shortValue() |
default <T> T |
to(Class<T> type)
Convert a raw value to the given type.
|
<T> T |
to(com.google.inject.TypeLiteral<T> type)
Convert a raw value to the given type.
|
default <T extends Enum<T>> |
toEnum(Class<T> type) |
default <T> List<T> |
toList(Class<T> type) |
default Optional<String> |
toOptional() |
default <T> Optional<T> |
toOptional(Class<T> type) |
default <T> Set<T> |
toSet(Class<T> type) |
default <T extends Comparable<T>> |
toSortedSet(Class<T> type) |
default String |
value() |
default boolean booleanValue()
default byte byteValue()
default char charValue()
default short shortValue()
default int intValue()
default long longValue()
default String value()
default float floatValue()
default double doubleValue()
default <T extends Enum<T>> T toEnum(Class<T> type)
T
- Enum type.type
- The enum type.default <T> List<T> toList(Class<T> type)
T
- List type.type
- The element type.default <T> Set<T> toSet(Class<T> type)
T
- Set type.type
- The element type.default <T extends Comparable<T>> SortedSet<T> toSortedSet(Class<T> type)
T
- Set type.type
- The element type.default <T> Optional<T> toOptional(Class<T> type)
T
- Optional type.type
- The optional type.default <T> T to(Class<T> type)
T
- Target type.type
- The type to convert to.<T> T to(com.google.inject.TypeLiteral<T> type)
T
- Target type.type
- The type to convert to.boolean isPresent()
Copyright © 2015. All rights reserved.