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 JacksonCodec.decodeAs(JsonNode, Class).

For internal use only. May be renamed or removed in a future release.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    decode(com.fasterxml.jackson.databind.JsonNode value, Class<T> type)
    Decode the given value to the required type.
    boolean
    isApplicable(com.fasterxml.jackson.databind.JsonNode value, Class<?> type)
    Returns true if the decoder is applicable for the given value and the required type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultRpcDecoder

      public DefaultRpcDecoder()
  • Method Details

    • isApplicable

      public boolean isApplicable(com.fasterxml.jackson.databind.JsonNode value, Class<?> type)
      Description copied from interface: RpcDecoder
      Returns true if the decoder is applicable for the given value and the required type.
      Specified by:
      isApplicable in interface RpcDecoder
      Parameters:
      value - the value which needs to be decoded
      type - the required type to decode
      Returns:
      true if this decoder is able to decode the value to the type, false otherwise
    • decode

      public <T> T decode(com.fasterxml.jackson.databind.JsonNode value, Class<T> type) throws RpcDecodeException
      Description copied from interface: RpcDecoder
      Decode the given value to the required type.

      RpcDecodeException is thrown if the value cannot be converted to the type (even though the decoder is applicable for the value and the type).

      Specified by:
      decode in interface RpcDecoder
      Type Parameters:
      T - the decoded value type
      Parameters:
      value - the value which needs to be decoded
      type - the required type to decode
      Returns:
      the decoded value
      Throws:
      RpcDecodeException - if the value cannot be converted to the type