Package org.jdbi.v3.vavr
Class VavrValueArgumentFactory
- java.lang.Object
-
- org.jdbi.v3.vavr.VavrValueArgumentFactory
-
- All Implemented Interfaces:
ArgumentFactory
class VavrValueArgumentFactory extends java.lang.Object implements ArgumentFactory
supports several vavr value classes (Option,Lazy,Either,TryandValidation) with the underlying "nested" value being resolved via "get"if there is no such value (Try-Failed, Either-Left...) a "null" value will be applied as argument value
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jdbi.v3.core.argument.ArgumentFactory
ArgumentFactory.Preparable
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<java.lang.Class<?>>VALUE_CLASSES
-
Constructor Summary
Constructors Constructor Description VavrValueArgumentFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<Argument>build(java.lang.reflect.Type type, java.lang.Object value, ConfigRegistry config)Returns anArgumentfor the given value if the factory supports it; empty otherwise.private static java.util.Optional<Argument>buildValueArgument(java.lang.reflect.Type type, ConfigRegistry config, io.vavr.Value<?> value)private static java.lang.reflect.TypeextractTypeOfValue(io.vavr.Value<?> value)
-
-
-
Method Detail
-
build
public java.util.Optional<Argument> build(java.lang.reflect.Type type, java.lang.Object value, ConfigRegistry config)
Description copied from interface:ArgumentFactoryReturns anArgumentfor the given value if the factory supports it; empty otherwise.- Specified by:
buildin interfaceArgumentFactory- Parameters:
type- the known 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(Type, Object),Arguments.findFor(Type, Object)
-
buildValueArgument
private static java.util.Optional<Argument> buildValueArgument(java.lang.reflect.Type type, ConfigRegistry config, io.vavr.Value<?> value)
-
extractTypeOfValue
private static java.lang.reflect.Type extractTypeOfValue(io.vavr.Value<?> value)
-
-