com.vaadin.flow.server.communication.rpc.
Interface RpcDecoder
All Superinterfaces:
All Known Implementing Classes:
DefaultRpcDecoder
, StringToEnumDecoder
, StringToNumberDecoder
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
Modifier and TypeMethodDescription<T> T
Decode the given
value
to the requiredtype
.boolean
isApplicable
(elemental.json.JsonValue value, Class<?> type) Returns
true
if the decoder is applicable for the givenvalue
and the requiredtype
.
-
Method Details
-
isApplicable
Returns
true
if the decoder is applicable for the givenvalue
and the requiredtype
.Parameters:
value
- the value which needs to be decodedtype
- the required type to decodeReturns:
true
if this decoder is able to decode thevalue
to thetype
,false
otherwise -
decode
Decode the given
value
to the requiredtype
.RpcDecodeException
is thrown if thevalue
cannot be converted to thetype
(even though the decoder is applicable for thevalue
and thetype
).Type Parameters:
T
- the decoded value typeParameters:
value
- the value which needs to be decodedtype
- the required type to decodeReturns:
the decoded value
Throws:
RpcDecodeException
- if thevalue
cannot be converted to thetype
-