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
-
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.boolean
Returns true if bindingnull
to a variable declared as a primitive type is allowed.boolean
Returns 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.void
setBindingNullToPrimitivesPermitted
(boolean bindingNullToPrimitivesPermitted) Whether bindingnull
to a variable declared as a primitive type should be allowed.void
setPreparedArgumentsEnabled
(boolean preparedArgumentsEnabled) Configure whetherArgumentFactory.Preparable
factories will be processed before regularArgumentFactory
instances are.void
setRegistry
(ConfigRegistry registry) The registry will inject itself into the configuration object.void
setUntypedNullArgument
(Argument untypedNullArgument) Configure theArgument
to use when binding a null we don't have a type for.
-
Constructor Details
-
Arguments
-
-
Method Details
-
setRegistry
Description copied from interface:JdbiConfig
The 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:
setRegistry
in 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
-
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
-
prepareFor
-
getFactories
-
setUntypedNullArgument
-
getUntypedNullArgument
Returns the untyped null argument.- Returns:
- the untyped null argument.
-
isBindingNullToPrimitivesPermitted
public boolean isBindingNullToPrimitivesPermitted()Returns true if bindingnull
to a variable declared as a primitive type is allowed.- Returns:
- true if binding
null
to a variable declared as a primitive type is allowed.
-
setBindingNullToPrimitivesPermitted
public void setBindingNullToPrimitivesPermitted(boolean bindingNullToPrimitivesPermitted) Whether bindingnull
to a variable declared as a primitive type should be allowed.- Parameters:
bindingNullToPrimitivesPermitted
- if true,null
can 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.Preparable
factories will be processed before regularArgumentFactory
instances 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:JdbiConfig
Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopy
in interfaceJdbiConfig<Arguments>
- Returns:
- a copy of this configuration object.
-