Interface FunctionCatalog

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      Set<String> getNames​(Class<?> type)  
      default <T> T lookup​(Class<?> type, String functionDefinition)
      Will look up the instance of the functional interface by name and type which can only be Supplier, Consumer or Function.
      <T> T lookup​(Class<?> type, String functionDefinition, String... expectedOutputMimeTypes)  
      default <T> T lookup​(String functionDefinition)
      Will look up the instance of the functional interface by name only.
      default <T> T lookup​(String functionDefinition, String... expectedOutputMimeTypes)
      Will look up the instance of the functional interface by name only.
      default int size()
      Return the count of functions registered in this catalog.
    • Method Detail

      • lookup

        default <T> T lookup​(String functionDefinition)
        Will look up the instance of the functional interface by name only.
        Type Parameters:
        T - instance type
        Parameters:
        functionDefinition - the definition of the functional interface. Must not be null;
        Returns:
        instance of the functional interface registered with this catalog
      • lookup

        default <T> T lookup​(Class<?> type,
                             String functionDefinition)
        Will look up the instance of the functional interface by name and type which can only be Supplier, Consumer or Function. If type is not provided, the lookup will be made based on name only.
        Type Parameters:
        T - instance type
        Parameters:
        type - the type of functional interface. Can be null
        functionDefinition - the definition of the functional interface. Must not be null;
        Returns:
        instance of the functional interface registered with this catalog
      • lookup

        default <T> T lookup​(String functionDefinition,
                             String... expectedOutputMimeTypes)
        Will look up the instance of the functional interface by name only. This lookup method assumes a very specific semantics which are: function sub-type(s) expected to be Message<byte[]>.
        For example,

        Function<Message<byte[]>, Message<byte[]>> or
        Function<Flux<Message<byte[]>>, Flux<Message<byte[]>>> or
        Consumer<Flux<Message<Flux<Message<byte[]>>> etc. . .

        The acceptedOutputMimeTypes are the string representation of MimeType where each mime-type in the provided array would correspond to the output with the same index (for cases of functions with multiple outputs) and is used to convert such output back to Message<byte[]>. If you need to provide several accepted types per specific output you can simply delimit them with comma (e.g., application/json,text/plain...).
        Type Parameters:
        T - instance type which should be one of Supplier, Function or Consumer.
        Parameters:
        functionDefinition - the definition of a function (e.g., 'foo' or 'foo|bar')
        acceptedOutputMimeTypes - acceptedOutputMimeTypes array of string representation of MimeTypes used to convert function output back to Message<byte[]>.
        Returns:
        instance of the functional interface registered with this catalog
      • lookup

        <T> T lookup​(Class<?> type,
                     String functionDefinition,
                     String... expectedOutputMimeTypes)
      • size

        default int size()
        Return the count of functions registered in this catalog.
        Returns:
        the count of functions registered in this catalog