com.vaadin.flow.templatemodel.

Interface ModelEncoder<D,E extends Serializable>

  • Type Parameters:

    D - the decoded type

    E - the encoded type

    All Superinterfaces:

    Serializable


    public interface ModelEncoder<D,E extends Serializable>
    extends Serializable

    Interface for implementing type encodings in template models together with the Encode annotation. Used for enabling the use of types in template model methods that are not natively supported by the framework.

    Since:

    1.0

    Author:

    Vaadin Ltd

    See Also:

    Encode

    • Method Summary

      All Methods
      Modifier and Type Method and Description
      D decode(E value)

      Decodes the given value.

      E encode(D value)

      Encodes the given value.

      default Class<D> getDecodedType()

      Get the decoded type of this encoder.

      default Class<E> getEncodedType()

      Get the encoded type of this encoder.

    • Method Detail

      • getDecodedType

        default Class<D> getDecodedType()

        Get the decoded type of this encoder.

        Returns:

        the application type

      • getEncodedType

        default Class<E> getEncodedType()

        Get the encoded type of this encoder.

        Returns:

        the model type

      • encode

        E encode(D value)

        Encodes the given value.

        Parameters:

        value - the value to encode

        Returns:

        the encoded model value

      • decode

        D decode(E value)

        Decodes the given value.

        Parameters:

        value - the value to decode

        Returns:

        the decoded value