Class DefaultRpcDecoder
- java.lang.Object
-
- com.vaadin.flow.server.communication.rpc.DefaultRpcDecoder
-
- All Implemented Interfaces:
RpcDecoder
,Serializable
public class DefaultRpcDecoder extends Object implements RpcDecoder
Decodes the standard basic types from their JSON representation.Delegates to the standard JSON deserializer method
JsonCodec.decodeAs(JsonValue, Class)
.For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
JsonCodec.decodeAs(JsonValue, Class)
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultRpcDecoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
decode(elemental.json.JsonValue value, Class<T> type)
Decode the givenvalue
to the requiredtype
.boolean
isApplicable(elemental.json.JsonValue value, Class<?> type)
Returnstrue
if the decoder is applicable for the givenvalue
and the requiredtype
.
-
-
-
Method Detail
-
isApplicable
public boolean isApplicable(elemental.json.JsonValue value, Class<?> type)
Description copied from interface:RpcDecoder
Returnstrue
if the decoder is applicable for the givenvalue
and the requiredtype
.- Specified by:
isApplicable
in interfaceRpcDecoder
- Parameters:
value
- the value which needs to be decodedtype
- the required type to decode- Returns:
true
if this decoder is able to decode thevalue
to thetype
,false
otherwise
-
decode
public <T> T decode(elemental.json.JsonValue value, Class<T> type) throws RpcDecodeException
Description copied from interface:RpcDecoder
Decode the givenvalue
to the requiredtype
.RpcDecodeException
is thrown if thevalue
cannot be converted to thetype
(even though the decoder is applicable for thevalue
and thetype
).- Specified by:
decode
in interfaceRpcDecoder
- 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 thevalue
cannot be converted to thetype
-
-