Interface EntryProcessor<K,V,E,T>

Type Parameters:
K - the type of the key
V - the type of the value
E - the type of the key-value entry
T - the type of the collection

public interface EntryProcessor<K,V,E,T>
An interface to processing entries of the collection.
  • 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 provided Out.
      Type Parameters:
      O - the type of the output destination
      Parameters:
      out - the Out for writing the encoded key
      entry - the key-value entry to encode to the Out
      Returns:
      a result containing null if the operation succeeded, or a EncodeError if 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 provided Out.
      Type Parameters:
      O - the type of the output destination
      Parameters:
      out - the Out instance for writing the encoded value
      entry - the key-value entry whose value is to be encoded
      Returns:
      a result containing the output destination if the operation is successful, or an EncodeError if the operation fails
    • toEntryIterator

      @NotNull @NotNull Iterator<E> toEntryIterator(@UnknownNullability T input)
      Creates an Iterator from EntryProcessor for encoding entries.
      Parameters:
      input - the object to encode
      Returns:
      the Iterator of entries
    • decodeKey

      @NotNull @NotNull dev.siroshun.jfun.result.Result<K,DecodeError> decodeKey(@NotNull @NotNull In in)
      Decodes a key from the provided input source.
      Parameters:
      in - the In for reading the key to decode
      Returns:
      a result containing the decoded key if the operation is successful, or a DecodeError if 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 - the In for reading the value to decode
      Returns:
      a result containing the decoded value if the operation is successful, or a DecodeError if the decoding process fails
    • createIdentity

      @NotNull T createIdentity()
      Returns:
      a EntryProcessor for an identity of In.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 of EntryProcessor.
      Parameters:
      identity - the identity object
      key - the key
      value - the value
      Returns:
      the Result of accepting the entry
    • finalizeIdentity

      @NotNull T finalizeIdentity(@NotNull T identity)
      Finalizes the identity object of EntryProcessor.
      Parameters:
      identity - the identity object
      Returns:
      the final EntryProcessor object