Interface DataMapperLibrary


  • public interface DataMapperLibrary

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

    • Method Detail

      • getLibraryName

        java.lang.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> java.util.Optional<DataMapper<T>> getDataMapper​(java.lang.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> java.util.Optional<DataMapper<T>> getOptionalDataMapper​(java.lang.String spec,
                                                                            java.lang.Class<? extends T> clazz)
      • getDataMapper

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

        boolean canParseSpec​(java.lang.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

        java.util.Optional<ResolvedFunction> resolveFunction​(java.lang.String spec)
      • resolveFunctions

        java.util.List<ResolvedFunction> resolveFunctions​(java.lang.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

        java.util.List<java.lang.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 java.util.Optional<DataMapper<java.lang.Long>> getLongDataMapper​(java.lang.String spec)
      • getDoubleDataMapper

        default java.util.Optional<DataMapper<java.lang.Double>> getDoubleDataMapper​(java.lang.String spec)
      • getIntegerDataMapper

        default java.util.Optional<DataMapper<java.lang.Integer>> getIntegerDataMapper​(java.lang.String spec)
      • getStringDataMapper

        default java.util.Optional<DataMapper<java.lang.String>> getStringDataMapper​(java.lang.String spec)