Class JdbiImmutables
- java.lang.Object
-
- org.jdbi.v3.core.mapper.immutables.JdbiImmutables
-
- All Implemented Interfaces:
JdbiConfig<JdbiImmutables>
@Beta public class JdbiImmutables extends java.lang.Object implements JdbiConfig<JdbiImmutables>
-
-
Field Summary
Fields Modifier and Type Field Description private ConfigRegistryregistry
-
Constructor Summary
Constructors Constructor Description JdbiImmutables()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <S> java.lang.Class<? extends S>classByPrefix(java.lang.String prefix, java.lang.Class<S> spec)private static <S> java.util.function.Supplier<S>constructorOf(java.lang.Class<S> impl)JdbiImmutablescreateCopy()Returns a copy of this configuration object.private static java.util.Optional<java.util.function.Supplier<?>>nullaryMethodOf(java.lang.Class<?> impl, java.lang.String methodName)private JdbiImmutablesregister(java.lang.Class<?> spec, java.lang.Class<?> impl, PojoPropertiesFactory factory)JdbiImmutablesregisterImmutable(java.lang.Class<?>... specs)Convenience method for registering many immutable types.<S> JdbiImmutablesregisterImmutable(java.lang.Class<S> spec)Register bean arguments and row mapping for anImmutable*value class, expecting the default generated class and builder names.<S,I extends S>
JdbiImmutablesregisterImmutable(java.lang.Class<S> spec, java.lang.Class<I> impl, java.util.function.Supplier<?> builder)Register bean arguments and row mapping for anImmutable*value class, using a supplied implementation and builder.JdbiImmutablesregisterImmutable(java.lang.Iterable<java.lang.Class<?>> specs)Convenience method for registering many immutable types.JdbiImmutablesregisterModifiable(java.lang.Class<?>... specs)Convenience method for registering many modifiable types.<S> JdbiImmutablesregisterModifiable(java.lang.Class<S> spec)Register bean arguments and row mapping for anModifiable*value class, expecting the default generated class and public nullary constructor.<S,M extends S>
JdbiImmutablesregisterModifiable(java.lang.Class<S> spec, java.lang.Class<M> impl, java.util.function.Supplier<?> constructor)Register bean arguments and row mapping for anModifiable*value class, using a supplied implementation and constructor.JdbiImmutablesregisterModifiable(java.lang.Iterable<java.lang.Class<?>> specs)Convenience method for registering many modifiable types.voidsetRegistry(ConfigRegistry registry)The registry will inject itself into the configuration object.
-
-
-
Field Detail
-
registry
private ConfigRegistry registry
-
-
Method Detail
-
setRegistry
public void setRegistry(ConfigRegistry registry)
Description copied from interface:JdbiConfigThe registry will inject itself into the configuration object. This can be useful if you need to look up dependencies. You will get a new registry after being copied.- Specified by:
setRegistryin interfaceJdbiConfig<JdbiImmutables>- Parameters:
registry- the registry that owns this configuration object
-
registerImmutable
public <S> JdbiImmutables registerImmutable(java.lang.Class<S> spec)
Register bean arguments and row mapping for anImmutable*value class, expecting the default generated class and builder names.- Type Parameters:
S- the specification class- Parameters:
spec- the specification interface or abstract class- Returns:
- a plugin that configures type mapping for the given class
-
registerImmutable
public JdbiImmutables registerImmutable(java.lang.Class<?>... specs)
Convenience method for registering many immutable types.- See Also:
registerImmutable(Class)
-
registerImmutable
public JdbiImmutables registerImmutable(java.lang.Iterable<java.lang.Class<?>> specs)
Convenience method for registering many immutable types.- See Also:
registerImmutable(Class)
-
registerImmutable
public <S,I extends S> JdbiImmutables registerImmutable(java.lang.Class<S> spec, java.lang.Class<I> impl, java.util.function.Supplier<?> builder)
Register bean arguments and row mapping for anImmutable*value class, using a supplied implementation and builder.- Type Parameters:
S- the specification classI- the implementation class- Parameters:
spec- the specification interface or abstract classimpl- the generated implementation classbuilder- a supplier of new Builder instances- Returns:
- a plugin that configures type mapping for the given class
-
registerModifiable
public JdbiImmutables registerModifiable(java.lang.Class<?>... specs)
Convenience method for registering many modifiable types.- See Also:
registerModifiable(Class)
-
registerModifiable
public JdbiImmutables registerModifiable(java.lang.Iterable<java.lang.Class<?>> specs)
Convenience method for registering many modifiable types.- See Also:
registerModifiable(Class)
-
registerModifiable
public <S> JdbiImmutables registerModifiable(java.lang.Class<S> spec)
Register bean arguments and row mapping for anModifiable*value class, expecting the default generated class and public nullary constructor.- Type Parameters:
S- the specification class- Parameters:
spec- the specification interface or abstract class- Returns:
- a plugin that configures type mapping for the given class
-
registerModifiable
public <S,M extends S> JdbiImmutables registerModifiable(java.lang.Class<S> spec, java.lang.Class<M> impl, java.util.function.Supplier<?> constructor)
Register bean arguments and row mapping for anModifiable*value class, using a supplied implementation and constructor.- Type Parameters:
S- the specification classM- the modifiable class- Parameters:
spec- the specification interface or abstract classimpl- the modifiable classconstructor- a supplier of new Modifiable instances- Returns:
- a plugin that configures type mapping for the given class
-
register
private JdbiImmutables register(java.lang.Class<?> spec, java.lang.Class<?> impl, PojoPropertiesFactory factory)
-
nullaryMethodOf
private static java.util.Optional<java.util.function.Supplier<?>> nullaryMethodOf(java.lang.Class<?> impl, java.lang.String methodName)
-
constructorOf
private static <S> java.util.function.Supplier<S> constructorOf(java.lang.Class<S> impl)
-
classByPrefix
private static <S> java.lang.Class<? extends S> classByPrefix(java.lang.String prefix, java.lang.Class<S> spec)
-
createCopy
public JdbiImmutables createCopy()
Description copied from interface:JdbiConfigReturns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopyin interfaceJdbiConfig<JdbiImmutables>- Returns:
- a copy of this configuration object.
-
-