Interface RpcDecoder
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DefaultRpcDecoder,StringToEnumDecoder,StringToNumberDecoder
public interface RpcDecoder extends Serializable
Decoder of RPC method arguments (server-side methods invoked from the client-side).The client-side argument type and the server-side argument type doesn't have to match. The decoders are applied to be able to handle arguments whose types on the server side and on the client side are different.
Each decoder is checked whether it's may be used to handle the argument value with the required server-side parameter type via the
isApplicable(JsonValue, Class)method. Decoder is applied to the received value and required type if it's applicable.For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tdecode(elemental.json.JsonValue value, Class<T> type)Decode the givenvalueto the requiredtype.booleanisApplicable(elemental.json.JsonValue value, Class<?> type)Returnstrueif the decoder is applicable for the givenvalueand the requiredtype.
-
-
-
Method Detail
-
isApplicable
boolean isApplicable(elemental.json.JsonValue value, Class<?> type)Returnstrueif the decoder is applicable for the givenvalueand the requiredtype.- Parameters:
value- the value which needs to be decodedtype- the required type to decode- Returns:
trueif this decoder is able to decode thevalueto thetype,falseotherwise
-
decode
<T> T decode(elemental.json.JsonValue value, Class<T> type) throws RpcDecodeExceptionDecode the givenvalueto the requiredtype.RpcDecodeExceptionis thrown if thevaluecannot be converted to thetype(even though the decoder is applicable for thevalueand thetype).- Type Parameters:
T- the decoded value type- Parameters:
value- the value which needs to be decodedtype- the required type to decode- Returns:
- the decoded value
- Throws:
RpcDecodeException- if thevaluecannot be converted to thetype
-
-