Package org.jdbi.v3.core.extension
Class ExtensionFactoryDelegate
- java.lang.Object
-
- org.jdbi.v3.core.extension.ExtensionFactoryDelegate
-
- All Implemented Interfaces:
ExtensionFactory
final class ExtensionFactoryDelegate extends java.lang.Object implements ExtensionFactory
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jdbi.v3.core.extension.ExtensionFactory
ExtensionFactory.FactoryFlag
-
-
Field Summary
Fields Modifier and Type Field Description private ExtensionFactorydelegatedFactory
-
Constructor Summary
Constructors Constructor Description ExtensionFactoryDelegate(ExtensionFactory delegatedFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(java.lang.Class<?> extensionType)Returns true if the factory can process the given extension type.<E> Eattach(java.lang.Class<E> extensionType, HandleSupplier handleSupplier)Attaches an extension type.voidbuildExtensionMetadata(ExtensionMetadata.Builder builder)Receives theExtensionMetadata.Builderwhen theExtensionMetadataobject for this extension is created.private java.util.Optional<java.lang.reflect.Method>checkMethodPresent(java.lang.Class<?> extensionType, java.lang.Class<?> klass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)returns Optional.empty() if the method exists in the extension type, otherwise a fallback method.java.util.Collection<ConfigCustomizerFactory>getConfigCustomizerFactories(ConfigRegistry config)Returns a collection ofConfigCustomizerFactoryobjects.(package private) ExtensionFactorygetDelegatedFactory()java.util.Collection<ExtensionHandlerCustomizer>getExtensionHandlerCustomizers(ConfigRegistry config)Returns a collection ofExtensionHandlerCustomizerobjects.java.util.Collection<ExtensionHandlerFactory>getExtensionHandlerFactories(ConfigRegistry config)Returns a collection ofExtensionHandlerFactoryobjects.java.util.Set<ExtensionFactory.FactoryFlag>getFactoryFlags()Returns a set ofExtensionFactory.FactoryFlags that describe the extension factory.java.lang.StringtoString()
-
-
-
Field Detail
-
delegatedFactory
private final ExtensionFactory delegatedFactory
-
-
Constructor Detail
-
ExtensionFactoryDelegate
ExtensionFactoryDelegate(ExtensionFactory delegatedFactory)
-
-
Method Detail
-
accepts
public boolean accepts(java.lang.Class<?> extensionType)
Description copied from interface:ExtensionFactoryReturns true if the factory can process the given extension type.- Specified by:
acceptsin interfaceExtensionFactory- Parameters:
extensionType- the extension type- Returns:
- whether the factory can produce an extension of the given type
-
getDelegatedFactory
ExtensionFactory getDelegatedFactory()
-
getExtensionHandlerFactories
public java.util.Collection<ExtensionHandlerFactory> getExtensionHandlerFactories(ConfigRegistry config)
Description copied from interface:ExtensionFactoryReturns a collection ofExtensionHandlerFactoryobjects. These factories are used in addition to the factories that have been registered withExtensions.registerHandlerFactory(org.jdbi.v3.core.extension.ExtensionHandlerFactory).
Handler factories returned here can customize the behavior of the Extension factory itself.- Specified by:
getExtensionHandlerFactoriesin interfaceExtensionFactory- Parameters:
config- A Configuration registry object that can be used to look up additional information- Returns:
- A collection of
ExtensionHandlerFactoryobjects. Can be empty, must not be null
-
getExtensionHandlerCustomizers
public java.util.Collection<ExtensionHandlerCustomizer> getExtensionHandlerCustomizers(ConfigRegistry config)
Description copied from interface:ExtensionFactoryReturns a collection ofExtensionHandlerCustomizerobjects. These customizers are used in addition to the customizers that have been registered withExtensions.registerHandlerCustomizer(org.jdbi.v3.core.extension.ExtensionHandlerCustomizer).
Handler customizers returned here can customize the behavior of the Handlers returned by the handler factories.- Specified by:
getExtensionHandlerCustomizersin interfaceExtensionFactory- Parameters:
config- A Configuration registry object that can be used to look up additional information- Returns:
- A collection of
ExtensionHandlerCustomizerobjects. Can be empty, must not be null
-
getConfigCustomizerFactories
public java.util.Collection<ConfigCustomizerFactory> getConfigCustomizerFactories(ConfigRegistry config)
Description copied from interface:ExtensionFactoryReturns a collection ofConfigCustomizerFactoryobjects.
Each factory is called once for every type that is attached by the factory and once for each method in the type. They can returnConfigCustomizerinstances that will affect the specific configuration for each method and extension type.- Specified by:
getConfigCustomizerFactoriesin interfaceExtensionFactory- Parameters:
config- A Configuration registry object that can be used to look up additional information- Returns:
- A collection of
ConfigCustomizerFactoryobjects. Can be empty, must not be null
-
buildExtensionMetadata
public void buildExtensionMetadata(ExtensionMetadata.Builder builder)
Description copied from interface:ExtensionFactoryReceives theExtensionMetadata.Builderwhen theExtensionMetadataobject for this extension is created. The factory can add additional method handlers or specific instance and method customizers as needed.
Code here can call methods on the builder to configure the metadata object.- Specified by:
buildExtensionMetadatain interfaceExtensionFactory- Parameters:
builder- The builder object that is used to create theExtensionMetadataobject
-
getFactoryFlags
public java.util.Set<ExtensionFactory.FactoryFlag> getFactoryFlags()
Description copied from interface:ExtensionFactoryReturns a set ofExtensionFactory.FactoryFlags that describe the extension factory.- Specified by:
getFactoryFlagsin interfaceExtensionFactory- Returns:
- A set of
ExtensionFactory.FactoryFlagelements. Default is the empty set
-
attach
public <E> E attach(java.lang.Class<E> extensionType, HandleSupplier handleSupplier)Description copied from interface:ExtensionFactoryAttaches an extension type. This method is not called ifExtensionFactory.getFactoryFlags()containsExtensionFactory.FactoryFlag.NON_VIRTUAL_FACTORY.- Specified by:
attachin interfaceExtensionFactory- Type Parameters:
E- the extension type- Parameters:
extensionType- The extension typehandleSupplier- Supplies the database handle. This supplier may lazily open a Handle on the first invocation. Extension implementors should take care not to fetch the handle before it is needed, to avoid opening handles unnecessarily- Returns:
- An extension of the given type, attached to the given handle
- See Also:
Jdbi.onDemand(Class)
-
checkMethodPresent
private java.util.Optional<java.lang.reflect.Method> checkMethodPresent(java.lang.Class<?> extensionType, java.lang.Class<?> klass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)returns Optional.empty() if the method exists in the extension type, otherwise a fallback method.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-