Interface TranscoderProxy<D>

Type Parameters:
D - the type of the delegate transcoder
All Superinterfaces:
Transcoder<D>
All Known Implementing Classes:
RegistryTranscoder

public interface TranscoderProxy<D> extends Transcoder<D>
Proxies all transcoder calls to the given delegate. Exists to allow passing context into codec implementations by creating Transcoder subclasses.

Note: TranscoderProxy has some special handling assuming that all calls are forwarded. If that is not the case, you should inherit from Transcoder itself and NOT TranscoderProxy.

  • Method Details

    • extractDelegate

      static Transcoder<?> extractDelegate(Transcoder<?> transcoder)
      Recursively extracts the delegate from a TranscoderProxy.
      Parameters:
      transcoder - The transcoder (possibly proxy) to extract
      Returns:
      The delegate transcoder
    • delegate

      Transcoder<D> delegate()
    • createNull

      default D createNull()
      Description copied from interface: Transcoder
      Creates a null representation of Transcoder
      Specified by:
      createNull in interface Transcoder<D>
      Returns:
      the null object, never null
    • getBoolean

      default Result<Boolean> getBoolean(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a boolean from the value Transcoder
      Specified by:
      getBoolean in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createBoolean

      default D createBoolean(boolean value)
      Description copied from interface: Transcoder
      Creates a boolean representation of Transcoder
      Specified by:
      createBoolean in interface Transcoder<D>
      Parameters:
      value - the boolean primitive
      Returns:
      the representation of value in Transcoder
    • getByte

      default Result<Byte> getByte(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a byte from the value Transcoder
      Specified by:
      getByte in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createByte

      default D createByte(byte value)
      Description copied from interface: Transcoder
      Creates a byte representation of Transcoder
      Specified by:
      createByte in interface Transcoder<D>
      Parameters:
      value - the byte primitive
      Returns:
      the representation of value in Transcoder
    • getShort

      default Result<Short> getShort(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a short from the value Transcoder
      Specified by:
      getShort in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createShort

      default D createShort(short value)
      Description copied from interface: Transcoder
      Creates a short representation of Transcoder
      Specified by:
      createShort in interface Transcoder<D>
      Parameters:
      value - the short primitive
      Returns:
      the representation of value in Transcoder
    • getInt

      default Result<Integer> getInt(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap an int from the value Transcoder
      Specified by:
      getInt in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createInt

      default D createInt(int value)
      Description copied from interface: Transcoder
      Creates an int representation of Transcoder
      Specified by:
      createInt in interface Transcoder<D>
      Parameters:
      value - the int primitive
      Returns:
      the representation of value in Transcoder
    • getLong

      default Result<Long> getLong(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a long from the value Transcoder
      Specified by:
      getLong in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createLong

      default D createLong(long value)
      Description copied from interface: Transcoder
      Creates a long representation of Transcoder
      Specified by:
      createLong in interface Transcoder<D>
      Parameters:
      value - the long primitive
      Returns:
      the representation of value in Transcoder
    • getFloat

      default Result<Float> getFloat(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a float from the value Transcoder
      Specified by:
      getFloat in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createFloat

      default D createFloat(float value)
      Description copied from interface: Transcoder
      Creates a float representation of Transcoder
      Specified by:
      createFloat in interface Transcoder<D>
      Parameters:
      value - the float primitive
      Returns:
      the representation of value in Transcoder
    • getDouble

      default Result<Double> getDouble(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a double from the value Transcoder
      Specified by:
      getDouble in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createDouble

      default D createDouble(double value)
      Description copied from interface: Transcoder
      Creates a float representation of Transcoder
      Specified by:
      createDouble in interface Transcoder<D>
      Parameters:
      value - the float primitive
      Returns:
      the representation of value in Transcoder
    • getString

      default Result<String> getString(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a string from the value Transcoder
      Specified by:
      getString in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createString

      default D createString(String value)
      Description copied from interface: Transcoder
      Creates a string representation of Transcoder
      Specified by:
      createString in interface Transcoder<D>
      Parameters:
      value - the string primitive
      Returns:
      the representation of value in Transcoder
    • createByteArray

      default D createByteArray(byte[] value)
      Description copied from interface: Transcoder
      Creates a byte[] representation of Transcoder
      Specified by:
      createByteArray in interface Transcoder<D>
      Parameters:
      value - the byte array
      Returns:
      Transcoder representation of byte[]
    • getByteArray

      default Result<byte[]> getByteArray(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a byte[] from the value Transcoder
      Specified by:
      getByteArray in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createIntArray

      default D createIntArray(int[] value)
      Description copied from interface: Transcoder
      Creates a int[] representation of Transcoder
      Specified by:
      createIntArray in interface Transcoder<D>
      Parameters:
      value - the int array
      Returns:
      Transcoder representation of int[]
    • getIntArray

      default Result<int[]> getIntArray(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a int[] from the value Transcoder
      Specified by:
      getIntArray in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createLongArray

      default D createLongArray(long[] value)
      Description copied from interface: Transcoder
      Creates a long[] representation of Transcoder
      Specified by:
      createLongArray in interface Transcoder<D>
      Parameters:
      value - the long array
      Returns:
      Transcoder representation of long[]
    • getLongArray

      default Result<long[]> getLongArray(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a long[] from the value Transcoder
      Specified by:
      getLongArray in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • getList

      default Result<List<D>> getList(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a list from the value Transcoder
      The List decoded possibly has more of Transcoder contained inside.
      Specified by:
      getList in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • getMap

      default Result<Transcoder.MapLike<D>> getMap(D value)
      Description copied from interface: Transcoder
      Attempts to unwrap a map from the value Transcoder
      The Transcoder.MapLike decoded possibly has more of Transcoder contained inside.
      Specified by:
      getMap in interface Transcoder<D>
      Parameters:
      value - the value to unwrap
      Returns:
      the result
    • createMap

      default Transcoder.MapBuilder<D> createMap()
      Description copied from interface: Transcoder
      Specified by:
      createMap in interface Transcoder<D>
      Returns:
      a new Transcoder.MapBuilder
    • createList

      default Transcoder.ListBuilder<D> createList(int expectedSize)
      Description copied from interface: Transcoder
      Specified by:
      createList in interface Transcoder<D>
      Parameters:
      expectedSize - the initial size
      Returns:
      a list builder
    • convertTo

      default <O> Result<O> convertTo(Transcoder<O> coder, D value)
      Description copied from interface: Transcoder
      Converts the current intermediary of Transcoder into intermediary Transcoder
      Specified by:
      convertTo in interface Transcoder<D>
      Type Parameters:
      O - the intermediary type to convert to
      Parameters:
      coder - the transcoder to convert to
      value - the value to convert
      Returns:
      the resultant of the conversion