Interface QualifiedArgumentFactory
- All Known Subinterfaces:
QualifiedArgumentFactory.Preparable
- All Known Implementing Classes:
CodecFactory
,TypeResolvingCodecFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Inspect a value with optional static qualified type information and produce an
Argument
that binds the value to a prepared statement.
Make sure to override Object.toString()
in your Argument
instances if you want
to be able to log their values with an SqlLogger
.
Note that null
is handled specially in a few cases, and a few Jdbi
features
assume you'll return an instance of NullArgument
when you intend to bind null.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
QualifiedArgumentFactory extension interface that allows preparing arguments for efficient batch binding. -
Method Summary
Modifier and TypeMethodDescriptionstatic QualifiedArgumentFactory
adapt
(ConfigRegistry config, ArgumentFactory factory) Adapts anArgumentFactory
into a QualifiedArgumentFactory.adapt
(ConfigRegistry config, ArgumentFactory.Preparable factory) Adapts anArgumentFactory.Preparable
into a QualifiedArgumentFactory.Preparable.build
(QualifiedType<?> type, Object value, ConfigRegistry config) Returns anArgument
for the given value if the factory supports it; empty otherwise.
-
Method Details
-
build
Returns anArgument
for the given value if the factory supports it; empty otherwise.- Parameters:
type
- the known qualified type of value. Depending on the situation this may be a full generic signature e.g.ParameterizedType
, aClass
, or Object.class if no type information is known.value
- the value to convert into anArgument
config
- the config registry, for composition- Returns:
- an argument for the given value if this factory supports it, or
Optional.empty()
otherwise. - See Also:
-
adapt
Adapts anArgumentFactory
into a QualifiedArgumentFactory. The returned factory only matches qualified types with zero qualifiers.- Parameters:
config
- the ConfigRegistryfactory
- the factory to adapt
-
adapt
static QualifiedArgumentFactory.Preparable adapt(ConfigRegistry config, ArgumentFactory.Preparable factory) Adapts anArgumentFactory.Preparable
into a QualifiedArgumentFactory.Preparable. The returned factory only matches qualified types with zero qualifiers.- Parameters:
factory
- the factory to adapt
-