Package org.jdbi.v3.core.argument
Class Arguments
java.lang.Object
org.jdbi.v3.core.argument.Arguments
- All Implemented Interfaces:
JdbiConfig<Arguments>
A registry for ArgumentFactory instances.
When a statement with bound parameters is executed, Jdbi consults the
Arguments registry to obtain an Argument instance for each bound parameter
(see #findFor(...)).
The factories are consulted in reverse order of registration (i.e. last-registered wins).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this configuration object.Obtain an argument for given value in the given contextfindFor(QualifiedType<?> type, Object value) Obtain an argument for given value in the given context.Returns the untyped null argument.booleanReturns true if bindingnullto a variable declared as a primitive type is allowed.booleanReturns true if prepared arguments binding is enabled.prepareFor(Type type) Obtain a prepared argument function for given type in the given context.prepareFor(QualifiedType<?> type) Obtain a prepared argument function for given type in the given context.register(ArgumentFactory factory) Registers the given argument factory.register(QualifiedArgumentFactory factory) Registers the given qualified argument factory.voidsetBindingNullToPrimitivesPermitted(boolean bindingNullToPrimitivesPermitted) Whether bindingnullto a variable declared as a primitive type should be allowed.voidsetPreparedArgumentsEnabled(boolean preparedArgumentsEnabled) Configure whetherArgumentFactory.Preparablefactories will be processed before regularArgumentFactoryinstances are.voidsetRegistry(ConfigRegistry registry) The registry will inject itself into the configuration object.voidsetUntypedNullArgument(Argument untypedNullArgument) Configure theArgumentto use when binding a null we don't have a type for.
-
Constructor Details
-
Arguments
-
-
Method Details
-
setRegistry
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<Arguments>- Parameters:
registry- the registry that owns this configuration object
-
register
Registers the given argument factory. If more than one of the registered factories supports a given parameter type, the last-registered factory wins.- Parameters:
factory- the factory to add- Returns:
- this
-
register
Registers the given qualified argument factory. If more than one of the registered factories supports a given parameter type, the last-registered factory wins.- Parameters:
factory- the qualified factory to add- Returns:
- this
-
findFor
Obtain an argument for given value in the given context- Parameters:
type- the type of the argument.value- the argument value.- Returns:
- an Argument for the given value.
-
findFor
Obtain an argument for given value in the given context.- Parameters:
type- the qualified type of the argument.value- the argument value.- Returns:
- an Argument for the given value.
-
prepareFor
Obtain a prepared argument function for given type in the given context.- Parameters:
type- the type of the argument.- Returns:
- an Argument factory function for the given value.
-
prepareFor
Obtain a prepared argument function for given type in the given context.- Parameters:
type- the qualified type of the argument.- Returns:
- an Argument factory function for the given value.
-
getFactories
-
setUntypedNullArgument
Configure theArgumentto use when binding a null we don't have a type for.- Parameters:
untypedNullArgument- the argument to bind
-
getUntypedNullArgument
Returns the untyped null argument.- Returns:
- the untyped null argument.
-
isBindingNullToPrimitivesPermitted
public boolean isBindingNullToPrimitivesPermitted()Returns true if bindingnullto a variable declared as a primitive type is allowed.- Returns:
- true if binding
nullto a variable declared as a primitive type is allowed.
-
setBindingNullToPrimitivesPermitted
public void setBindingNullToPrimitivesPermitted(boolean bindingNullToPrimitivesPermitted) Whether bindingnullto a variable declared as a primitive type should be allowed.- Parameters:
bindingNullToPrimitivesPermitted- if true,nullcan be bound to a variable declared as a primitive type.
-
isPreparedArgumentsEnabled
public boolean isPreparedArgumentsEnabled()Returns true if prepared arguments binding is enabled. Settings this improves performance.- Returns:
- true if prepared arguments binding is enabled.
-
setPreparedArgumentsEnabled
public void setPreparedArgumentsEnabled(boolean preparedArgumentsEnabled) Configure whetherArgumentFactory.Preparablefactories will be processed before regularArgumentFactoryinstances are. This improves speed at a small cost to backwards compatibility. Please disable it if you require the old semantics.- Parameters:
preparedArgumentsEnabled- whether to enable preparable argument factories
-
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<Arguments>- Returns:
- a copy of this configuration object.
-