com.vaadin.flow.server.communication.rpc.
Class StringToEnumDecoder
All Implemented Interfaces:
Decodes a JsonValue
with JsonType.STRING
type to Enum
subclass type.
This decoder is applicable to any JsonValue
which is
JsonString
and any Enum
sublcass
For internal use only. May be renamed or removed in a future release.
Since:
1.0
Author:
Vaadin Ltd
See Also:
-
Constructor Summary
Constructors -
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
.
-
Constructor Details
-
StringToEnumDecoder
public StringToEnumDecoder()
-
-
Method Details
-
isApplicable
Description copied from interface:
RpcDecoder
Returns
true
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 decodeReturns:
true
if this decoder is able to decode thevalue
to thetype
,false
otherwise -
decode
Description copied from interface:
RpcDecoder
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
).Specified by:
decode
in interfaceRpcDecoder
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
-