StringDelegateCoder (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

Class StringDelegateCoder<T>

  • Type Parameters:
    T - The type of objects coded.
    All Implemented Interfaces:
    Coder<T>, Serializable

    public class StringDelegateCoder<T>
    extends DelegateCoder<T,String>
    A Coder that wraps a Coder<String> and encodes/decodes values via string representations.

    To decode, the input byte stream is decoded to a String, and this is passed to the single-argument constructor for T.

    To encode, the input value is converted via toString(), and this string is encoded.

    In order for this to operate correctly for a class Clazz, it must be the case for any instance x that x.equals(new Clazz(x.toString())).

    This method of encoding is not designed for ease of evolution of Clazz; it should only be used in cases where the class is stable or the encoding is not important. If evolution of the class is important, see ProtoCoder, AvroCoder, or JAXBCoder.

    See Also:
    Serialized Form
    • Constructor Detail

      • StringDelegateCoder

        protected StringDelegateCoder(Class<T> clazz)