Class AbstractArgumentFactory<T>

java.lang.Object
org.jdbi.v3.core.argument.AbstractArgumentFactory<T>
Type Parameters:
T - the type of argument supported by this factory.
All Implemented Interfaces:
ArgumentFactory, ArgumentFactory.Preparable
Direct Known Subclasses:
CharSequenceArgumentFactory, DateTimeArgumentFactory, DurationArgumentFactory, HStoreArgumentFactory, InetArgumentFactory, JavaTimeZoneIdArgumentFactory, PeriodArgumentFactory, TypedEnumArgumentFactory

public abstract class AbstractArgumentFactory<T> extends Object implements ArgumentFactory.Preparable
An ArgumentFactory base class for arguments of type T. For values of type T, factories produces arguments from the build(Object, ConfigRegistry) method. For null values with a known expected type of T, produces null arguments for the sqlType passed to the constructor.
 class ValueType {
     String value;
 }

 class ValueTypeArgumentFactory extends AbstractArgumentFactory<ValueType> {
     ValueTypeArgumentFactory() {
         super(Types.VARCHAR);
     }

     @Override
     protected Argument build(ValueType valueType, ConfigRegistry config) {
         return (pos, stmt, ctx) -> stmt.setString(pos, valueType.value);
     }
 }
 
Don't forget to override Object.toString() in your Argument instances if you want to be able to log their values with an SqlLogger.