Package org.jdbi.v3.core.extension
Class UseAnnotationExtensionHandlerFactory
- java.lang.Object
-
- org.jdbi.v3.core.extension.UseAnnotationExtensionHandlerFactory
-
- All Implemented Interfaces:
ExtensionHandlerFactory
final class UseAnnotationExtensionHandlerFactory extends java.lang.Object implements ExtensionHandlerFactory
ProcessesUseExtensionHandlerannotations on methods.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ExtensionHandlerFactoryINSTANCE
-
Constructor Summary
Constructors Constructor Description UseAnnotationExtensionHandlerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(java.lang.Class<?> extensionType, java.lang.reflect.Method method)Determines whether the factory can create anExtensionHandlerfor combination of extension type and method.java.util.Optional<ExtensionHandler>createExtensionHandler(java.lang.Class<?> extensionType, java.lang.reflect.Method method)Returns anExtensionHandlerinstance for a extension type and method combination.private ExtensionHandlercreateExtensionHandler(java.lang.Class<? extends ExtensionHandler> handlerType, java.lang.Class<?> extensionObjectType, java.lang.reflect.Method method)(package private) static java.util.List<java.lang.Class<?>>findAnnotations(java.lang.reflect.Method method)private static booleanmatchAnnotation(java.lang.annotation.Annotation a)
-
-
-
Field Detail
-
INSTANCE
static final ExtensionHandlerFactory INSTANCE
-
-
Method Detail
-
accepts
public boolean accepts(java.lang.Class<?> extensionType, java.lang.reflect.Method method)Description copied from interface:ExtensionHandlerFactoryDetermines whether the factory can create anExtensionHandlerfor combination of extension type and method.- Specified by:
acceptsin interfaceExtensionHandlerFactory- Parameters:
extensionType- The extension type classmethod- A method- Returns:
- True if the factory can create an extension handler for extension type and method, false otherwise
-
matchAnnotation
private static boolean matchAnnotation(java.lang.annotation.Annotation a)
-
findAnnotations
static java.util.List<java.lang.Class<?>> findAnnotations(java.lang.reflect.Method method)
-
createExtensionHandler
public java.util.Optional<ExtensionHandler> createExtensionHandler(java.lang.Class<?> extensionType, java.lang.reflect.Method method)
Description copied from interface:ExtensionHandlerFactoryReturns anExtensionHandlerinstance for a extension type and method combination.- Specified by:
createExtensionHandlerin interfaceExtensionHandlerFactory- Parameters:
extensionType- The extension type classmethod- A method- Returns:
- An
ExtensionHandlerinstance wrapped into anOptional. The optional can be empty. This is necessary to retrofit old code that does not have an accept/build code pair but unconditionally tries to build a handler and returns empty if it can not. New code should always returnOptional.of(extensionHandler}and never returnOptional.empty()
-
createExtensionHandler
private ExtensionHandler createExtensionHandler(java.lang.Class<? extends ExtensionHandler> handlerType, java.lang.Class<?> extensionObjectType, java.lang.reflect.Method method)
-
-