Interface ElementDecoder<E,R>
- Type Parameters:
E- the type of the elementR- the type of the result
- All Superinterfaces:
Decoder<R>
A
Decoder for decoding elements from an In.readList(Object, java.util.function.BiFunction).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn interface to processing elements of the collection. -
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull dev.siroshun.jfun.result.Result<R, DecodeError> Decodes the data from the providedIn.Returns theElementDecoder.DecodeProcessorfor decoding elements and collect them.Creates aElementDecoderfor decoding elements as aList.Creates aElementDecoderfor decoding elements as aSet.Creates aElementDecoderfor decoding elements as aSet.Methods inherited from interface dev.siroshun.codec4j.api.decoder.Decoder
catchError, flatMap, inspect, map, toListDecoder, toOptionalFieldDecoder, toRequiredFieldDecoder, toSetDecoder, toSetDecoder, toSupplyingFieldDecoder
-
Method Details
-
list
Creates aElementDecoderfor decoding elements as aList.- Type Parameters:
E- the type of the element- Parameters:
elementDecoder- theDecoderfor decoding elements- Returns:
- a
ElementDecoderfor decoding elements as aList
-
set
Creates aElementDecoderfor decoding elements as aSet.This decoder does not allow duplicate elements.
- Type Parameters:
E- the type of the element- Parameters:
elementDecoder- theDecoderfor decoding elements- Returns:
- a
ElementDecoderfor decoding elements as aSet
-
set
@NotNull static <E> @NotNull Decoder<Set<E>> set(@NotNull @NotNull Decoder<E> elementDecoder, boolean allowDuplicates) Creates aElementDecoderfor decoding elements as aSet.- Type Parameters:
E- the type of the element- Parameters:
elementDecoder- theDecoderfor decoding elementsallowDuplicates- whether to allow duplicate elements- Returns:
- a
ElementDecoderfor decoding elements as aSet
-
decodeProcessor
Returns theElementDecoder.DecodeProcessorfor decoding elements and collect them.- Returns:
- the
ElementDecoder.DecodeProcessor
-
decode
Description copied from interface:DecoderDecodes the data from the providedIn.- Specified by:
decodein interfaceDecoder<E>- Parameters:
in- theInfor reading the data to decode- Returns:
- a result containing the decoded data, or a
DecodeErrorif the operation failed
-