Package org.jdbi.v3.core.codec
Class CodecFactory
java.lang.Object
org.jdbi.v3.core.codec.CodecFactory
- All Implemented Interfaces:
QualifiedArgumentFactory,QualifiedArgumentFactory.Preparable,QualifiedColumnMapperFactory
- Direct Known Subclasses:
TypeResolvingCodecFactory
@ThreadSafe
@Beta
public class CodecFactory
extends Object
implements QualifiedColumnMapperFactory, QualifiedArgumentFactory.Preparable
CodecFactory provides column mappers and arguments for bidirectional mapping types to database columns.
This class is immutable and thread safe.
Alpha: this class as public API is redundant with the existing way of managing mappers: we should try to combine them to make the new public API as small as possible
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.jdbi.v3.core.argument.QualifiedArgumentFactory
QualifiedArgumentFactory.Preparable -
Constructor Summary
ConstructorsConstructorDescriptionCodecFactory(Map<QualifiedType<?>, Codec<?>> codecMap) Create a new CodecFactory. -
Method Summary
Modifier and TypeMethodDescriptionbuild(QualifiedType<?> type, Object value, ConfigRegistry config) Returns anArgumentfor the given value if the factory supports it; empty otherwise.final Optional<ColumnMapper<?>> build(QualifiedType<?> type, ConfigRegistry config) Supplies a column mapper which will map columns to type if the factory supports it; empty otherwise.static CodecFactory.Builderbuilder()Returns a builder for fluent API.static CodecFactoryforSingleCodec(QualifiedType<?> type, Codec<?> codec) prepare(QualifiedType<?> type, ConfigRegistry config) final Collection<QualifiedType<?>> Deprecated.no longer used
-
Constructor Details
-
CodecFactory
Create a new CodecFactory.
-
-
Method Details
-
builder
Returns a builder for fluent API. -
forSingleCodec
-
prepare
public final Optional<Function<Object,Argument>> prepare(QualifiedType<?> type, ConfigRegistry config) - Specified by:
preparein interfaceQualifiedArgumentFactory.Preparable
-
prePreparedTypes
Deprecated.no longer used- Specified by:
prePreparedTypesin interfaceQualifiedArgumentFactory.Preparable
-
build
Description copied from interface:QualifiedArgumentFactoryReturns anArgumentfor the given value if the factory supports it; empty otherwise.- Specified by:
buildin interfaceQualifiedArgumentFactory- 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:
-
build
Description copied from interface:QualifiedColumnMapperFactorySupplies a column mapper which will map columns to type if the factory supports it; empty otherwise.- Specified by:
buildin interfaceQualifiedColumnMapperFactory- Parameters:
type- the target qualified type to map toconfig- the config registry, for composition- Returns:
- a column mapper for the given type if this factory supports it, or
Optional.empty()otherwise. - See Also:
-