Interface DataMapperLibrary


public interface DataMapperLibrary

A DataMapperLibrary is an independently loadable library of data mapping functions.

  • Method Details

    • getLibraryName

      String getLibraryName()

      Return the name for this data mapper implementation, as it can be used in spec strings, etc.

      Returns:
      Simple lower-case canonical library name
    • getDataMapper

      default <T> Optional<DataMapper<T>> getDataMapper(String spec)

      Find the implementation for and construct an instance of a data mapper function, as described.

      Type Parameters:
      T - The result type produced by the data mapping function.
      Parameters:
      spec - A specifier that describes the type and or parameterization of a data mapping function instance.
      Returns:
      An optional data mapping function instance
    • getOptionalDataMapper

      default <T> Optional<DataMapper<T>> getOptionalDataMapper(String spec, Class<? extends T> clazz)
    • getDataMapper

      default <T> DataMapper<T> getDataMapper(String spec, Class<? extends T> clazz)
    • canParseSpec

      boolean canParseSpec(String spec)
      DataMapper Libraries are required to test specifier strings in order to determine whether or not the library could possibly find matching functions. This allows varying types of specifiers to be used that are library specific, allowing an ad-hoc form of syntax layering.
      Parameters:
      spec - a data mapping function spec
      Returns:
      a tagged Specifier option if successful
    • resolveFunction

      Optional<ResolvedFunction> resolveFunction(String spec)
    • resolveFunctions

      List<ResolvedFunction> resolveFunctions(String specifier)
      Parameters:
      specifier - A specifier that describes the type and parameterization of a data mapping function instance. The type of specifier will be specific to your library implementation. You can use SpecData by default.
      Returns:
      a list of function instances
    • getDataMapperNames

      List<String> getDataMapperNames()

      Get the list of known data mapping function names.

      Returns:
      list of data mapping function names that can be used in specifiers
    • getLongDataMapper

      default Optional<DataMapper<Long>> getLongDataMapper(String spec)
    • getDoubleDataMapper

      default Optional<DataMapper<Double>> getDoubleDataMapper(String spec)
    • getIntegerDataMapper

      default Optional<DataMapper<Integer>> getIntegerDataMapper(String spec)
    • getStringDataMapper

      default Optional<DataMapper<String>> getStringDataMapper(String spec)