Interface EntryProcessor<K,V,E,T>
- Type Parameters:
K- the type of the keyV- the type of the valueE- the type of the key-value entryT- the type of the collection
public interface EntryProcessor<K,V,E,T>
An interface to processing entries of the collection.
-
Method Summary
Modifier and TypeMethodDescription@NotNull dev.siroshun.jfun.result.Result<Void, DecodeError> acceptEntry(T identity, @UnknownNullability K key, @UnknownNullability V value) Accepts the key-value entry to the identity object ofEntryProcessor.Creates aEntryProcessorfor an identity ofIn.readMap(Object, java.util.function.BiFunction).@NotNull dev.siroshun.jfun.result.Result<K, DecodeError> Decodes a key from the provided input source.@NotNull dev.siroshun.jfun.result.Result<V, DecodeError> decodeValue(@NotNull In in) Decodes a value from the provided input source.<O> @NotNull dev.siroshun.jfun.result.Result<O, EncodeError> Encodes the key of the entry to the providedOut.<O> @NotNull dev.siroshun.jfun.result.Result<O, EncodeError> encodeValue(@NotNull Out<O> out, @UnknownNullability E entry) Encodes the value of the given entry to the providedOut.finalizeIdentity(T identity) Finalizes the identity object ofEntryProcessor.toEntryIterator(@UnknownNullability T input) Creates anIteratorfromEntryProcessorfor encoding entries.
-
Method Details
-
encodeKey
@NotNull <O> @NotNull dev.siroshun.jfun.result.Result<O,EncodeError> encodeKey(@NotNull @NotNull Out<O> out, @UnknownNullability E entry) Encodes the key of the entry to the providedOut.- Type Parameters:
O- the type of the output destination- Parameters:
out- theOutfor writing the encoded keyentry- the key-value entry to encode to theOut- Returns:
- a result containing
nullif the operation succeeded, or aEncodeErrorif the operation failed
-
encodeValue
@NotNull <O> @NotNull dev.siroshun.jfun.result.Result<O,EncodeError> encodeValue(@NotNull @NotNull Out<O> out, @UnknownNullability E entry) Encodes the value of the given entry to the providedOut.- Type Parameters:
O- the type of the output destination- Parameters:
out- theOutinstance for writing the encoded valueentry- the key-value entry whose value is to be encoded- Returns:
- a result containing the output destination if the operation is successful, or an
EncodeErrorif the operation fails
-
toEntryIterator
Creates anIteratorfromEntryProcessorfor encoding entries.- Parameters:
input- the object to encode- Returns:
- the
Iteratorof entries
-
decodeKey
Decodes a key from the provided input source.- Parameters:
in- theInfor reading the key to decode- Returns:
- a result containing the decoded key if the operation is successful, or a
DecodeErrorif the decoding process fails
-
decodeValue
@NotNull @NotNull dev.siroshun.jfun.result.Result<V,DecodeError> decodeValue(@NotNull @NotNull In in) Decodes a value from the provided input source.- Parameters:
in- theInfor reading the value to decode- Returns:
- a result containing the decoded value if the operation is successful, or a
DecodeErrorif the decoding process fails
-
createIdentity
Creates aEntryProcessorfor an identity ofIn.readMap(Object, java.util.function.BiFunction).- Returns:
- a
EntryProcessorfor an identity ofIn.readMap(Object, java.util.function.BiFunction)
-
acceptEntry
@NotNull @NotNull dev.siroshun.jfun.result.Result<Void,DecodeError> acceptEntry(@NotNull T identity, @UnknownNullability K key, @UnknownNullability V value) Accepts the key-value entry to the identity object ofEntryProcessor.- Parameters:
identity- the identity objectkey- the keyvalue- the value- Returns:
- the
Resultof accepting the entry
-
finalizeIdentity
Finalizes the identity object ofEntryProcessor.- Parameters:
identity- the identity object- Returns:
- the final
EntryProcessorobject
-