All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ar.com.kfgodel.primitons.api.repositories.FunctionReposity Maven / Gradle / Ivy

The newest version!
package ar.com.kfgodel.primitons.api.repositories;

import ar.com.kfgodel.nary.api.optionals.Optional;

import java.util.function.Function;

/**
 * This type represents a storage for primitive transformation functions (primitons)
 *
 * Date: 30/12/17 - 16:36
 */
public interface FunctionReposity {

  /**
   * Registers a transformation function for the given types. A previous function for the given types is replaced if present
   * @param inputType The class indicating the type of function input
   * @param outputType The class indicatung the function output
   * @param primiton The transformation function
   * @param  Expected input type
   * @param  Expected output type
   * @return This instance for method chaining
   */
   FunctionReposity addConverterFrom(Class inputType, Class outputType, Function primiton);

  /**
   * Returns a function that converts input of the given type to output of the expected type.
* If such a function is not present on this repo, an empty is returned * @param inputType The class indicating the possible input type * @param outputType The class indicating the expected output type * @param Expected input type * @param Exected output type * @return The optional function if found */ Optional> getConverterFrom(Class inputType, Class outputType); }