Package org.jdbi.v3.vavr
Class TupleMappers
- java.lang.Object
-
- org.jdbi.v3.vavr.TupleMappers
-
- All Implemented Interfaces:
JdbiConfig<TupleMappers>,MapEntryConfig<TupleMappers>
public class TupleMappers extends java.lang.Object implements JdbiConfig<TupleMappers>, MapEntryConfig<TupleMappers>
Mappers similar toMapEntryMappersbut map entries in vavr are in fact of typeTuple2.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]columnsprivate static intKEY_COLUMN_TUPLE_INDEXprivate ConfigRegistryregistryprivate static intVALUE_COLUMN_TUPLE_INDEX
-
Constructor Summary
Constructors Modifier Constructor Description TupleMappers()privateTupleMappers(TupleMappers that)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TupleMapperscreateCopy()Returns a copy of this configuration object.java.lang.StringgetColumn(int tupleIndex)Returns the name for a column.java.lang.StringgetKeyColumn()java.lang.StringgetValueColumn()TupleMapperssetColumn(int tupleIndex, java.lang.String name)Names a specific column in the mapper.TupleMapperssetKeyColumn(java.lang.String keyColumn)Sets the column that map entry keys are loaded from.voidsetRegistry(ConfigRegistry registry)The registry will inject itself into the configuration object.TupleMapperssetValueColumn(java.lang.String valueColumn)Sets the column that map entry values are loaded from.
-
-
-
Field Detail
-
KEY_COLUMN_TUPLE_INDEX
private static final int KEY_COLUMN_TUPLE_INDEX
- See Also:
- Constant Field Values
-
VALUE_COLUMN_TUPLE_INDEX
private static final int VALUE_COLUMN_TUPLE_INDEX
- See Also:
- Constant Field Values
-
registry
private ConfigRegistry registry
-
columns
private java.lang.String[] columns
-
-
Constructor Detail
-
TupleMappers
public TupleMappers()
-
TupleMappers
private TupleMappers(TupleMappers that)
-
-
Method Detail
-
getKeyColumn
public java.lang.String getKeyColumn()
- Specified by:
getKeyColumnin interfaceMapEntryConfig<TupleMappers>
-
setKeyColumn
public TupleMappers setKeyColumn(java.lang.String keyColumn)
Description copied from interface:MapEntryConfigSets the column that map entry keys are loaded from. If set, keys will be loaded from the given column, using theColumnMapperregistered for the key type. If unset, keys will be loaded using theRowMapperregistered for the key type, from whichever columns that row mapper uses.- Specified by:
setKeyColumnin interfaceMapEntryConfig<TupleMappers>- Parameters:
keyColumn- the key column name. not null- Returns:
- this config object, for call chaining
-
getValueColumn
public java.lang.String getValueColumn()
- Specified by:
getValueColumnin interfaceMapEntryConfig<TupleMappers>
-
setValueColumn
public TupleMappers setValueColumn(java.lang.String valueColumn)
Description copied from interface:MapEntryConfigSets the column that map entry values are loaded from. If set, values will be loaded from the given column, using theColumnMapperregistered for the value type. If unset, values will be loaded using theRowMapperregistered for the value type, from whichever columns that row mapper uses.- Specified by:
setValueColumnin interfaceMapEntryConfig<TupleMappers>- Parameters:
valueColumn- the value column name. not null- Returns:
- this config object, for call chaining
-
setColumn
public TupleMappers setColumn(int tupleIndex, java.lang.String name)
Names a specific column in the mapper.- Parameters:
tupleIndex- the 1 based index of the TupleX. as in _1, _2 etc.name- the column name to be mapped explicitly- Returns:
- Config object for chaining
-
getColumn
public java.lang.String getColumn(int tupleIndex)
Returns the name for a column.- Parameters:
tupleIndex- the 1 based index of the TupleX. as in _1, _2 etc.- Returns:
- the column name to be mapped explicitly
-
createCopy
public TupleMappers createCopy()
Description copied from interface:JdbiConfigReturns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopyin interfaceJdbiConfig<TupleMappers>- Returns:
- a copy of this configuration object.
-
setRegistry
public void setRegistry(ConfigRegistry registry)
Description copied from interface:JdbiConfigThe registry will inject itself into the configuration object. This can be useful if you need to look up dependencies. You will get a new registry after being copied.- Specified by:
setRegistryin interfaceJdbiConfig<TupleMappers>- Parameters:
registry- the registry that owns this configuration object
-
-