Package org.jdbi.v3.core.extension
Class ExtensionMetadata
- java.lang.Object
-
- org.jdbi.v3.core.extension.ExtensionMetadata
-
@Alpha public final class ExtensionMetadata extends java.lang.Object
Metadata that was detected when analyzing an extension class before attaching. Represents a resolved extension type with all config customizers and method handlers.- Since:
- 3.38.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExtensionMetadata.BuilderBuilder class for theExtensionMetadataobject.classExtensionMetadata.ExtensionHandlerInvokerWraps all config customizers and the handler for a specific method execution.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>extensionTypeprivate ConfigCustomizerinstanceConfigCustomizerprivate java.util.Map<java.lang.reflect.Method,? extends ConfigCustomizer>methodConfigCustomizersprivate java.util.Map<java.lang.reflect.Method,ExtensionHandler>methodHandlers
-
Constructor Summary
Constructors Modifier Constructor Description privateExtensionMetadata(java.lang.Class<?> extensionType, ConfigCustomizer instanceConfigCustomizer, java.util.Map<java.lang.reflect.Method,? extends ConfigCustomizer> methodConfigCustomizers, java.util.Map<java.lang.reflect.Method,ExtensionHandler> methodHandlers)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExtensionMetadata.Builderbuilder(java.lang.Class<?> extensionType)Returns a newExtensionMetadata.Builderinstance.<E> ExtensionMetadata.ExtensionHandlerInvokercreateExtensionHandlerInvoker(E target, java.lang.reflect.Method method, HandleSupplier handleSupplier, ConfigRegistry config)Creates anExtensionMetadata.ExtensionHandlerInvokerinstance for a specific method.ConfigRegistrycreateInstanceConfiguration(ConfigRegistry config)Create an instance specific configuration based on all instance customizers.ConfigRegistrycreateMethodConfiguration(java.lang.reflect.Method method, ConfigRegistry config)Create an method specific configuration based on all method customizers.java.lang.Class<?>extensionType()java.util.Set<java.lang.reflect.Method>getExtensionMethods()Returns a set of all Methods that haveExtensionHandlerobjects associated with them.
-
-
-
Field Detail
-
extensionType
private final java.lang.Class<?> extensionType
-
instanceConfigCustomizer
private final ConfigCustomizer instanceConfigCustomizer
-
methodConfigCustomizers
private final java.util.Map<java.lang.reflect.Method,? extends ConfigCustomizer> methodConfigCustomizers
-
methodHandlers
private final java.util.Map<java.lang.reflect.Method,ExtensionHandler> methodHandlers
-
-
Constructor Detail
-
ExtensionMetadata
private ExtensionMetadata(java.lang.Class<?> extensionType, ConfigCustomizer instanceConfigCustomizer, java.util.Map<java.lang.reflect.Method,? extends ConfigCustomizer> methodConfigCustomizers, java.util.Map<java.lang.reflect.Method,ExtensionHandler> methodHandlers)
-
-
Method Detail
-
builder
public static ExtensionMetadata.Builder builder(java.lang.Class<?> extensionType)
Returns a newExtensionMetadata.Builderinstance.- Parameters:
extensionType- The extension type for which metadata is collected- Returns:
- A new
ExtensionMetadata.Builderinstance
-
extensionType
public java.lang.Class<?> extensionType()
-
createInstanceConfiguration
public ConfigRegistry createInstanceConfiguration(ConfigRegistry config)
Create an instance specific configuration based on all instance customizers. The instance configuration holds all custom configuration that was applied e.g. through instance annotations.- Parameters:
config- A configuration object. The object is not changed- Returns:
- A new configuration object with all changes applied
-
createMethodConfiguration
public ConfigRegistry createMethodConfiguration(java.lang.reflect.Method method, ConfigRegistry config)
Create an method specific configuration based on all method customizers. The method configuration holds all custom configuration that was applied e.g. through method annotations.- Parameters:
method- The method that is about to be calledconfig- A configuration object. The object is not changed- Returns:
- A new configuration object with all changes applied
-
getExtensionMethods
public java.util.Set<java.lang.reflect.Method> getExtensionMethods()
Returns a set of all Methods that haveExtensionHandlerobjects associated with them.
-
createExtensionHandlerInvoker
public <E> ExtensionMetadata.ExtensionHandlerInvoker createExtensionHandlerInvoker(E target, java.lang.reflect.Method method, HandleSupplier handleSupplier, ConfigRegistry config)
Creates anExtensionMetadata.ExtensionHandlerInvokerinstance for a specific method.- Type Parameters:
E- THe type of the target object- Parameters:
target- The target object on which the invoker should workmethod- The method which will trigger the invocationhandleSupplier- AHandleSupplierthat will provide the handle object for the extension methodconfig- The configuration object which should be used as base for the method specific configuration- Returns:
- A
ExtensionMetadata.ExtensionHandlerInvokerobject that is linked to the method
-
-