Interface ElementDecoder<E,R>

Type Parameters:
E - the type of the element
R - the type of the result
All Superinterfaces:
Decoder<R>

public interface ElementDecoder<E,R> extends Decoder<R>
  • Method Details

    • list

      @NotNull static <E> @NotNull Decoder<List<E>> list(@NotNull @NotNull Decoder<E> elementDecoder)
      Creates a ElementDecoder for decoding elements as a List.
      Type Parameters:
      E - the type of the element
      Parameters:
      elementDecoder - the Decoder for decoding elements
      Returns:
      a ElementDecoder for decoding elements as a List
    • set

      @NotNull static <E> @NotNull Decoder<Set<E>> set(@NotNull @NotNull Decoder<E> elementDecoder)
      Creates a ElementDecoder for decoding elements as a Set.

      This decoder does not allow duplicate elements.

      Type Parameters:
      E - the type of the element
      Parameters:
      elementDecoder - the Decoder for decoding elements
      Returns:
      a ElementDecoder for decoding elements as a Set
    • set

      @NotNull static <E> @NotNull Decoder<Set<E>> set(@NotNull @NotNull Decoder<E> elementDecoder, boolean allowDuplicates)
      Creates a ElementDecoder for decoding elements as a Set.
      Type Parameters:
      E - the type of the element
      Parameters:
      elementDecoder - the Decoder for decoding elements
      allowDuplicates - whether to allow duplicate elements
      Returns:
      a ElementDecoder for decoding elements as a Set
    • decodeProcessor

      @NotNull ElementDecoder.DecodeProcessor<E,R> decodeProcessor()
      Returns the ElementDecoder.DecodeProcessor for decoding elements and collect them.
      Returns:
      the ElementDecoder.DecodeProcessor
    • decode

      @NotNull default @NotNull dev.siroshun.jfun.result.Result<R,DecodeError> decode(In in)
      Description copied from interface: Decoder
      Decodes the data from the provided In.
      Specified by:
      decode in interface Decoder<E>
      Parameters:
      in - the In for reading the data to decode
      Returns:
      a result containing the decoded data, or a DecodeError if the operation failed