Interface Mapper<I,O>

Type Parameters:
I - The input type
O - The output type
All Known Subinterfaces:
BooleanMapper, FloatMapper, IntMapper, ParseFunction<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Mapper<I,O>
A function that maps one type to another type.
  • Method Summary

    Modifier and Type
    Method
    Description
    map(I in)
    Maps an object.
    static <T> Mapper<T,String>
    Creates a mapper that converts objects to strings.
    static <T, S> Mapper<T,S>
    preserveNull(Mapper<T,S> mapper)
    Creates a mapper that preserves null values.
    default <T> Mapper<I,T>
    then(Mapper<O,T> mapper)
    Creates a mapper that chains this mapper and another mapper.
    static <T extends Transmittable<S>, S>
    Mapper<T,S>
    transmitTo(Supplier<S> supplier)
    Creates a mapper that transmits data between two objects.
  • Method Details

    • map

      O map(I in)
      Maps an object.
      Parameters:
      in - The original object
      Returns:
      The mapped object.
    • then

      default <T> Mapper<I,T> then(Mapper<O,T> mapper)
      Creates a mapper that chains this mapper and another mapper.
      Type Parameters:
      T - The output type of the resulting mapper
      Parameters:
      mapper - The mapper to chain with this mapper
      Returns:
      A mapper that chains both mappers.
    • preserveNull

      static <T, S> Mapper<T,S> preserveNull(Mapper<T,S> mapper)
      Creates a mapper that preserves null values.
      Type Parameters:
      T - The input type of the mapper
      S - The output type of the mapper
      Parameters:
      mapper - The mapper to use for non-null values
      Returns:
      A new mapper that preserves null values.
    • mapToString

      static <T> Mapper<T,String> mapToString()
      Creates a mapper that converts objects to strings.
      Type Parameters:
      T - The input type
      Returns:
      A mapper that converts objects to strings.
      See Also:
    • transmitTo

      static <T extends Transmittable<S>, S> Mapper<T,S> transmitTo(Supplier<S> supplier)
      Creates a mapper that transmits data between two objects.
      Type Parameters:
      T - The source object type
      S - The target object type
      Parameters:
      supplier - The supplier of the target object
      Returns:
      A new mapper that transmits data.