@Singleton public class DefaultLocalFunctionRegistry extends Object implements ExecutableMethodProcessor<FunctionBean>, LocalFunctionRegistry, MediaTypeCodecRegistry
Default implementation of the LocalFunctionRegistry
interface
FUNCTION_CHARSET, FUNCTION_NAME, FUNCTION_PREFIX
Constructor and Description |
---|
DefaultLocalFunctionRegistry(List<MediaTypeCodec> decoders)
Constructor.
|
DefaultLocalFunctionRegistry(MediaTypeCodec... decoders)
Constructor.
|
DefaultLocalFunctionRegistry(MediaTypeCodecRegistry codecRegistry)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Optional<? extends ExecutableMethod<?,?>> |
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. |
Optional<? extends ExecutableMethod<?,?>> |
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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
of, of
public DefaultLocalFunctionRegistry(MediaTypeCodec... decoders)
decoders
- decoders@Inject public DefaultLocalFunctionRegistry(List<MediaTypeCodec> decoders)
decoders
- decoderspublic DefaultLocalFunctionRegistry(MediaTypeCodecRegistry codecRegistry)
codecRegistry
- codecRegistrypublic Optional<? extends ExecutableMethod<?,?>> findFirst()
LocalFunctionRegistry
findFirst
in interface LocalFunctionRegistry
ExecutableMethod
method representing the functionpublic Optional<? extends ExecutableMethod<?,?>> find(String name)
LocalFunctionRegistry
find
in interface LocalFunctionRegistry
name
- the nameExecutableMethod
method representing the functionpublic Map<String,URI> getAvailableFunctions()
LocalFunctionRegistry
getAvailableFunctions
in interface LocalFunctionRegistry
public <T> Optional<ExecutableMethod<Supplier<T>,T>> findSupplier(String name)
LocalFunctionRegistry
Supplier
for the given name.findSupplier
in interface LocalFunctionRegistry
T
- The typename
- The nameOptional
of a Supplier
public <T> Optional<ExecutableMethod<Consumer<T>,Void>> findConsumer(String name)
LocalFunctionRegistry
Consumer
for the given name.findConsumer
in interface LocalFunctionRegistry
T
- The typename
- The nameOptional
of a Consumer
public <T,R> Optional<ExecutableMethod<Function<T,R>,R>> findFunction(String name)
LocalFunctionRegistry
Function
for the given name.findFunction
in interface LocalFunctionRegistry
T
- The typeR
- The result of the method callname
- The nameOptional
of a Function
public <T,U,R> Optional<ExecutableMethod<BiFunction<T,U,R>,R>> findBiFunction(String name)
LocalFunctionRegistry
BiFunction
for the given name.findBiFunction
in interface LocalFunctionRegistry
T
- The typeU
- the type of the second argument to the functionR
- The result of the method callname
- The nameOptional
of a BiFunction
public void process(BeanDefinition<?> beanDefinition, ExecutableMethod<?,?> method)
ExecutableMethodProcessor
ExecutableMethod
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 Optional<MediaTypeCodec> findCodec(@Nullable MediaType mediaType)
MediaTypeCodecRegistry
findCodec
in interface MediaTypeCodecRegistry
mediaType
- The MediaType
public Optional<MediaTypeCodec> findCodec(@Nullable MediaType mediaType, Class<?> type)
MediaTypeCodecRegistry
findCodec
in interface MediaTypeCodecRegistry
mediaType
- The MediaType
type
- The typepublic Collection<MediaTypeCodec> getCodecs()
getCodecs
in interface MediaTypeCodecRegistry