Package org.jdbi.v3.core.argument
Interface QualifiedArgumentFactory
-
- All Known Subinterfaces:
QualifiedArgumentFactory.Preparable
- All Known Implementing Classes:
CodecFactory,EnumArgumentFactory,TypeResolvingCodecFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface QualifiedArgumentFactoryInspect a value with optional static qualified type information and produce anArgumentthat binds the value to a prepared statement.Make sure to override
Object.toString()in yourArgumentinstances if you want to be able to log their values with anSqlLogger.Note that
nullis handled specially in a few cases, and a fewJdbifeatures assume you'll return an instance ofNullArgumentwhen you intend to bind null.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceQualifiedArgumentFactory.PreparableQualifiedArgumentFactory extension interface that allows preparing arguments for efficient batch binding.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static QualifiedArgumentFactoryadapt(ConfigRegistry config, ArgumentFactory factory)Adapts anArgumentFactoryinto a QualifiedArgumentFactory.static QualifiedArgumentFactory.Preparableadapt(ConfigRegistry config, ArgumentFactory.Preparable factory)Adapts anArgumentFactory.Preparableinto a QualifiedArgumentFactory.Preparable.java.util.Optional<Argument>build(QualifiedType<?> type, java.lang.Object value, ConfigRegistry config)Returns anArgumentfor the given value if the factory supports it; empty otherwise.
-
-
-
Method Detail
-
build
java.util.Optional<Argument> build(QualifiedType<?> type, java.lang.Object value, ConfigRegistry config)
Returns anArgumentfor 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 anArgumentconfig- the config registry, for composition- Returns:
- an argument for the given value if this factory supports it, or
Optional.empty()otherwise. - See Also:
StatementContext.findArgumentFor(QualifiedType, Object),Arguments.findFor(QualifiedType, Object),QualifiedType
-
adapt
static QualifiedArgumentFactory adapt(ConfigRegistry config, ArgumentFactory factory)
Adapts anArgumentFactoryinto 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.Preparableinto a QualifiedArgumentFactory.Preparable. The returned factory only matches qualified types with zero qualifiers.- Parameters:
factory- the factory to adapt
-
-