Interface VirtDataFunctionLibrary

  • All Superinterfaces:
    Named
    All Known Implementing Classes:
    VirtDataLibraries

    public interface VirtDataFunctionLibrary
    extends Named
    A VirtDataFunctionLibrary is simply a way to ask for a set of named function objects in a generic way.
    • Method Summary

      Modifier and Type Method Description
      default <T> java.util.Optional<DataMapper<T>> getDataMapper​(java.lang.String spec)
      Provide a way to promote a long function into a data mapper.
      default <T> java.util.List<DataMapper<T>> getDataMappers​(java.lang.String spec)  
      java.util.List<ResolvedFunction> resolveFunctions​(java.lang.Class<?> returnType, java.lang.Class<?> inputType, java.lang.String functionName, java.lang.Object... parameters)
      Given a signature for a unary function which takes an input and output type, a function name, and constructor arguments, return a list of instances from all implementations that have the same name as the function name, which have a matching constructor signature, and which also have a functional method which can be used with the provided input and output types.
      default java.util.List<ResolvedFunction> resolveFunctions​(java.lang.String spec)  
      • Methods inherited from interface io.virtdata.api.Named

        getName
    • Method Detail

      • resolveFunctions

        java.util.List<ResolvedFunction> resolveFunctions​(java.lang.Class<?> returnType,
                                                          java.lang.Class<?> inputType,
                                                          java.lang.String functionName,
                                                          java.lang.Object... parameters)
        Given a signature for a unary function which takes an input and output type, a function name, and constructor arguments, return a list of instances from all implementations that have the same name as the function name, which have a matching constructor signature, and which also have a functional method which can be used with the provided input and output types. The input and output types are optionally specified. If either is provided, the returned functions should be constrained to match, but otherwise all possibly matching functions are included. Further, the argument should not be strict type checks, but should allow any matching constructor for which a compatible assignment can be made. The specified function name does not have to map to a
        Parameters:
        returnType - The class which the apply method should return, or null if unspecified
        inputType - The class which the unary apply method should take as an argument, or null if unspecified
        functionName - The name of the implementation to match
        parameters - A list of arguments which will be used to instantiate any matching implementations
        Returns:
        A list, possibly empty, of matching functions
      • resolveFunctions

        default java.util.List<ResolvedFunction> resolveFunctions​(java.lang.String spec)
      • getDataMappers

        default <T> java.util.List<DataMapper<T>> getDataMappers​(java.lang.String spec)
      • getDataMapper

        default <T> java.util.Optional<DataMapper<T>> getDataMapper​(java.lang.String spec)
        Provide a way to promote a long function into a data mapper.
        Type Parameters:
        T - The type of data mapper to return
        Parameters:
        spec - a binding spec
        Returns:
        An optional data mapper