Interface Codec.RawValue

Enclosing interface:
Codec<T extends @UnknownNullability Object>

public static sealed interface Codec.RawValue
A raw value wrapper for entry is an object combined with its current decoder. Allows converting of an intermediary object of a transcoder into the requested transcoder.
Useful when dealing with objects that have the same type required as their transcoder for example NBT and JSON.
  • Method Summary

    Modifier and Type
    Method
    Description
    <D> Result<D>
    Converts the current value into another transcoder
    static <D> Codec.RawValue
    of(Transcoder<D> coder, D value)
    Creates a RawValue instance
  • Method Details

    • of

      @Contract(pure=true) static <D> Codec.RawValue of(Transcoder<D> coder, D value)
      Creates a RawValue instance
      Type Parameters:
      D - The Object type
      Parameters:
      coder - the transcoder
      value - the value
      Returns:
      the new raw value instance
    • convertTo

      @Contract(pure=true) <D> Result<D> convertTo(Transcoder<D> coder)
      Converts the current value into another transcoder
      Type Parameters:
      D - the resultant type; transcoder type.
      Parameters:
      coder - the transcoder to convert the object into
      Returns:
      the Result of converting to coder.