Package org.jdbi.v3.guava.codec
Class TypeResolvingCodecFactory
java.lang.Object
org.jdbi.v3.core.codec.CodecFactory
org.jdbi.v3.guava.codec.TypeResolvingCodecFactory
- All Implemented Interfaces:
QualifiedArgumentFactory,QualifiedArgumentFactory.Preparable,QualifiedColumnMapperFactory
An extended
CodecFactory which can resolve Codecs for subtypes. This allows registering e.g. a codec for Set<String> and using any
subtype of Set which the same type parameters (e.g. a HashSet<String<) will find the right codec.
This is an experimental feature which relies on TypeToken from the Guava library.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jdbi.v3.core.codec.CodecFactory
CodecFactory.BuilderNested classes/interfaces inherited from interface org.jdbi.v3.core.argument.QualifiedArgumentFactory
QualifiedArgumentFactory.Preparable -
Constructor Summary
ConstructorsConstructorDescriptionTypeResolvingCodecFactory(Map<QualifiedType<?>, Codec<?>> codecMap) Create a new TypeResolvingCodecFactory. -
Method Summary
Modifier and TypeMethodDescriptionstatic CodecFactory.Builderbuilder()Returns a builder for fluent API.static CodecFactoryforSingleCodec(QualifiedType<?> type, Codec<?> codec) Creates aCodecFactoryfor a single type.Methods inherited from class org.jdbi.v3.core.codec.CodecFactory
build, build, prepare, prePreparedTypes
-
Constructor Details
-
TypeResolvingCodecFactory
Create a new TypeResolvingCodecFactory.
-
-
Method Details
-
builder
Returns a builder for fluent API.- Returns:
- A
CodecFactory.Builderinstance.
-
forSingleCodec
Creates aCodecFactoryfor a single type.- Parameters:
type- The type for which the factory is created.codec- TheCodecto use.- Returns:
- A new invalid input: '{@link /*missing*/}' CodecFactory that will be used if the given type is requested.
-