public class BeanFactoryAwareFunctionRegistry extends Object implements FunctionRegistry, FunctionInspector, org.springframework.context.ApplicationContextAware
FunctionRegistry and FunctionCatalog which is aware of the
underlying BeanFactory to access available functions. Functions that are registered via
register(FunctionRegistration) operation are stored/cached locally.| Modifier and Type | Class and Description |
|---|---|
class |
BeanFactoryAwareFunctionRegistry.FunctionInvocationWrapper
Single wrapper for all Suppliers, Functions and Consumers managed by this
catalog.
|
| Constructor and Description |
|---|
BeanFactoryAwareFunctionRegistry(org.springframework.core.convert.ConversionService conversionService,
org.springframework.messaging.converter.CompositeMessageConverter messageConverter) |
| Modifier and Type | Method and Description |
|---|---|
FunctionType |
getFunctionType(String name) |
Set<String> |
getNames(Class<?> type) |
FunctionRegistration<?> |
getRegistration(Object function) |
<T> T |
lookup(Class<?> type,
String definition)
Will look up the instance of the functional interface by name and type which
can only be Supplier, Consumer or Function.
|
<T> T |
lookup(String definition,
String... acceptedOutputTypes)
Will look up the instance of the functional interface by name only.
|
<T> void |
register(FunctionRegistration<T> registration) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
int |
size()
Return the count of functions registered in this catalog.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitlookupgetInputType, getInputWrapper, getName, getOutputType, getOutputWrapper, isMessagepublic BeanFactoryAwareFunctionRegistry(org.springframework.core.convert.ConversionService conversionService,
@Nullable
org.springframework.messaging.converter.CompositeMessageConverter messageConverter)
public <T> T lookup(Class<?> type, String definition)
FunctionCataloglookup in interface FunctionCatalogT - instance typetype - the type of functional interface. Can be nulldefinition - the definition of the functional interface. Must
not be null;public int size()
FunctionCatalogsize in interface FunctionCatalogpublic <T> T lookup(String definition, String... acceptedOutputTypes)
FunctionCatalogMessage<byte[]>. Function<Message<byte[]>, Message<byte[]>> or
Function<Flux<Message<byte[]>>, Flux<Message<byte[]>>> or
Consumer<Flux<Message<Flux<Message<byte[]>>> etc. . .
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...).lookup in interface FunctionCatalogT - instance type which should be one of Supplier, Function or Consumer.definition - the definition of a function (e.g., 'foo' or 'foo|bar')acceptedOutputTypes - acceptedOutputMimeTypes array of string representation of MimeTypes
used to convert function output back to Message<byte[]>.public Set<String> getNames(Class<?> type)
getNames in interface FunctionCatalogpublic <T> void register(FunctionRegistration<T> registration)
register in interface FunctionRegistrypublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic FunctionRegistration<?> getRegistration(Object function)
getRegistration in interface FunctionInspectorpublic FunctionType getFunctionType(String name)
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.