@Singleton @Replaces(value=DefaultLocalFunctionRegistry.class) public class AnnotatedFunctionRouteBuilder extends DefaultRouteBuilder implements ExecutableMethodProcessor<FunctionBean>, LocalFunctionRegistry, ServiceInstanceMetadataContributor, MediaTypeCodecRegistry
FunctionBean instances.RouteBuilder.UriNamingStrategyCAMEL_CASE_NAMING_STRATEGY, conversionService, defaultCharset, executionHandleLocator, LOG, uriNamingStrategyFUNCTION_CHARSET, FUNCTION_NAME, FUNCTION_PREFIXID| Constructor and Description |
|---|
AnnotatedFunctionRouteBuilder(ExecutionHandleLocator executionHandleLocator,
RouteBuilder.UriNamingStrategy uriNamingStrategy,
ConversionService<?> conversionService,
MediaTypeCodecRegistry codecRegistry,
String contextPath)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
contribute(ServiceInstance instance,
Map<String,String> metadata)
Contribute metadata to the given
ServiceInstance prior to registration. |
<T,R> Optional<? extends ExecutableMethod<T,R>> |
find(String name)
Find the first available registered function.
|
<T,U,R> Optional<ExecutableMethod<BiFunction<T,U,R>,R>> |
findBiFunction(String name)
Find a
BiFunction for the given name. |
Optional<MediaTypeCodec> |
findCodec(MediaType mediaType)
Find a codec for the given media type.
|
Optional<MediaTypeCodec> |
findCodec(MediaType mediaType,
Class<?> type)
Find a codec for the given media type and target type.
|
<T> Optional<ExecutableMethod<Consumer<T>,Void>> |
findConsumer(String name)
Find a
Consumer for the given name. |
<T,R> Optional<? extends ExecutableMethod<T,R>> |
findFirst()
Find the first available registered function.
|
<T,R> Optional<ExecutableMethod<Function<T,R>,R>> |
findFunction(String name)
Find a
Function for the given name. |
<T> Optional<ExecutableMethod<Supplier<T>,T>> |
findSupplier(String name)
Find a
Supplier for the given name. |
Map<String,URI> |
getAvailableFunctions()
A map of available functions with the key being the function name and the value being the function URI.
|
Collection<MediaTypeCodec> |
getCodecs() |
void |
process(BeanDefinition<?> beanDefinition,
ExecutableMethod<?,?> method)
The process method will be called for every
ExecutableMethod that is annotated with the type parameter A. |
addFilter, addFilter, buildBeanRoute, buildRoute, buildRoute, DELETE, DELETE, DELETE, error, error, GET, GET, GET, getErrorRoutes, getExposedPorts, getFilterRoutes, getStatusRoutes, getUriNamingStrategy, getUriRoutes, HEAD, HEAD, HEAD, OPTIONS, OPTIONS, OPTIONS, PATCH, PATCH, PATCH, POST, POST, POST, PUT, PUT, PUT, resources, single, status, status, TRACE, TRACE, TRACEclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitof, ofDELETE, DELETE, DELETE, DELETE, DELETE, DELETE, error, error, error, error, GET, GET, GET, GET, GET, GET, HEAD, HEAD, HEAD, HEAD, HEAD, HEAD, OPTIONS, OPTIONS, OPTIONS, OPTIONS, OPTIONS, OPTIONS, PATCH, PATCH, PATCH, PATCH, PATCH, PATCH, POST, POST, POST, POST, POST, POST, PUT, PUT, PUT, PUT, PUT, PUT, resources, single, status, TRACE, TRACE, TRACE, TRACE, TRACE, TRACEpublic AnnotatedFunctionRouteBuilder(ExecutionHandleLocator executionHandleLocator, RouteBuilder.UriNamingStrategy uriNamingStrategy, ConversionService<?> conversionService, MediaTypeCodecRegistry codecRegistry, @Value(value="${micronaut.function.context-path:/}") String contextPath)
executionHandleLocator - executionHandleLocatoruriNamingStrategy - uriNamingStrategyconversionService - conversionServicecodecRegistry - codecRegistrycontextPath - contextPathpublic void process(BeanDefinition<?> beanDefinition, ExecutableMethod<?,?> method)
ExecutableMethodProcessorExecutableMethod that is annotated with the type parameter A.process in interface AnnotationProcessor<FunctionBean,ExecutableMethod<?,?>>process in interface ExecutableMethodProcessor<FunctionBean>beanDefinition - The bean definition to processmethod - The executable methodpublic Map<String,URI> getAvailableFunctions()
getAvailableFunctions in interface LocalFunctionRegistrypublic <T,R> Optional<? extends ExecutableMethod<T,R>> findFirst()
LocalFunctionRegistryfindFirst in interface LocalFunctionRegistryT - The declaring typeR - The result of the method callExecutableMethod method representing the functionpublic <T,R> Optional<? extends ExecutableMethod<T,R>> find(String name)
LocalFunctionRegistryfind in interface LocalFunctionRegistryT - The declaring typeR - The result of the method callname - the nameExecutableMethod method representing the functionpublic <T> Optional<ExecutableMethod<Supplier<T>,T>> findSupplier(String name)
LocalFunctionRegistrySupplier for the given name.findSupplier in interface LocalFunctionRegistryT - The typename - The nameOptional of a Supplierpublic <T> Optional<ExecutableMethod<Consumer<T>,Void>> findConsumer(String name)
LocalFunctionRegistryConsumer for the given name.findConsumer in interface LocalFunctionRegistryT - The typename - The nameOptional of a Consumerpublic <T,R> Optional<ExecutableMethod<Function<T,R>,R>> findFunction(String name)
LocalFunctionRegistryFunction for the given name.findFunction in interface LocalFunctionRegistryT - The typeR - The result of the method callname - The nameOptional of a Functionpublic <T,U,R> Optional<ExecutableMethod<BiFunction<T,U,R>,R>> findBiFunction(String name)
LocalFunctionRegistryBiFunction for the given name.findBiFunction in interface LocalFunctionRegistryT - The typeU - the type of the second argument to the functionR - The result of the method callname - The nameOptional of a BiFunctionpublic void contribute(ServiceInstance instance, Map<String,String> metadata)
ServiceInstanceMetadataContributorServiceInstance prior to registration.contribute in interface ServiceInstanceMetadataContributorinstance - The instancemetadata - The metadatapublic Optional<MediaTypeCodec> findCodec(@Nullable MediaType mediaType)
MediaTypeCodecRegistryfindCodec in interface MediaTypeCodecRegistrymediaType - The MediaTypepublic Optional<MediaTypeCodec> findCodec(@Nullable MediaType mediaType, Class<?> type)
MediaTypeCodecRegistryfindCodec in interface MediaTypeCodecRegistrymediaType - The MediaTypetype - The typepublic Collection<MediaTypeCodec> getCodecs()
getCodecs in interface MediaTypeCodecRegistry