Package org.jdbi.v3.core.extension
Interface ExtensionHandlerFactory
-
- All Known Subinterfaces:
HandlerFactory
- All Known Implementing Classes:
BridgeMethodExtensionHandlerFactory,DefaultMethodExtensionHandlerFactory,FilteringExtensionHandlerFactory,InstanceExtensionHandlerFactory,SqlMethodHandlerFactory,UseAnnotationExtensionHandlerFactory
public interface ExtensionHandlerFactoryA factory to createExtensionHandlerinstances.
-
-
Method Summary
All Methods Instance Methods Abstract 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.
-
-
-
Method Detail
-
accepts
boolean accepts(java.lang.Class<?> extensionType, java.lang.reflect.Method method)Determines whether the factory can create anExtensionHandlerfor combination of extension type and method.- 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
-
createExtensionHandler
java.util.Optional<ExtensionHandler> createExtensionHandler(java.lang.Class<?> extensionType, java.lang.reflect.Method method)
Returns anExtensionHandlerinstance for a extension type and method combination.- 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()
-
-