Interface Codec<T>

Type Parameters:
T - the type

public interface Codec<T>
Converts one type to and from a JavaScript value.

Written by the Gradle plugin for every type it was told to generate one for, and registrable by hand for anything it cannot see. There is no reflective fallback: the compiler emits only what a program reaches, so a decoder discovered at runtime would need metadata for every field of every type that might arrive, which is the closure dead-code elimination exists to avoid.

Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Reads a value.
    encode(T value)
    Writes a value.
  • Method Details

    • decode

      T decode(TSObject value)
      Reads a value.
      Parameters:
      value - the JavaScript value
      Returns:
      the Java value
    • encode

      TSObject encode(T value)
      Writes a value.
      Parameters:
      value - the Java value
      Returns:
      the JavaScript value