public class SimpleFunctionRegistry extends Object implements FunctionRegistry, FunctionInspector
BeanFactoryAwareFunctionRegistry, this implementation does not depend on BeanFactory.| Modifier and Type | Class and Description |
|---|---|
class |
SimpleFunctionRegistry.FunctionInvocationWrapper
Single wrapper for all Suppliers, Functions and Consumers managed by this
catalog.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
COULD_NOT_CONVERT_INPUT
Identifies MessageConversionExceptions that happen when input can't be converted.
|
static String |
COULD_NOT_CONVERT_OUTPUT
Identifies MessageConversionExceptions that happen when output can't be converted.
|
| Constructor and Description |
|---|
SimpleFunctionRegistry(org.springframework.core.convert.ConversionService conversionService,
org.springframework.messaging.converter.CompositeMessageConverter messageConverter) |
| Modifier and Type | Method and Description |
|---|---|
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) |
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 static final String COULD_NOT_CONVERT_INPUT
public static final String COULD_NOT_CONVERT_OUTPUT
public SimpleFunctionRegistry(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 FunctionRegistration<?> getRegistration(Object function)
getRegistration in interface FunctionInspectorCopyright © 2021 Pivotal Software, Inc.. All rights reserved.