Package org.jdbi.v3.core.mapper
Class Mappers
java.lang.Object
org.jdbi.v3.core.mapper.Mappers
- All Implemented Interfaces:
JdbiConfig<Mappers>
Configuration class for obtaining row or column mappers.
This configuration is merely a convenience class, and does not have any
configuration of its own. All methods delegate to RowMappers or
ColumnMappers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this configuration object.Obtain a mapper for the given type.Obtain a mapper for the given type.findFor(GenericType<T> type) Obtain a mapper for the given type.findFor(QualifiedType<T> type) Obtain a mapper for the given qualified type.voidsetRegistry(ConfigRegistry registry) The registry will inject itself into the configuration object.
-
Constructor Details
-
Mappers
public Mappers()
-
-
Method Details
-
setRegistry
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<Mappers>- Parameters:
registry- the registry that owns this configuration object
-
findFor
Obtain a mapper for the given type. If a row mapper is registered for the given type, it is returned. If a column mapper is registered for the given type, it is adapted into a row mapper, mapping the first column of the result set. If neither a row or column mapper is registered, empty is returned.- Type Parameters:
T- the type of the mapper to find- Parameters:
type- the target type to map to- Returns:
- a mapper for the given type, or empty if no row or column mapper is registered for the given type.
-
findFor
Obtain a mapper for the given type. If a row mapper is registered for the given type, it is returned. If a column mapper is registered for the given type, it is adapted into a row mapper, mapping the first column of the result set. If neither a row or column mapper is registered, empty is returned.- Type Parameters:
T- the type of the mapper to find- Parameters:
type- the target type to map to- Returns:
- a mapper for the given type, or empty if no row or column mapper is registered for the given type.
-
findFor
Obtain a mapper for the given type. If a row mapper is registered for the given type, it is returned. If a column mapper is registered for the given type, it is adapted into a row mapper, mapping the first column of the result set. If neither a row or column mapper is registered, empty is returned.- Parameters:
type- the target type to map to- Returns:
- a mapper for the given type, or empty if no row or column mapper is registered for the given type.
-
findFor
Obtain a mapper for the given qualified type. If the type is unqualified, and a row mapper is registered for the given type, it is returned. If a column mapper is registered for the given qualified type, it is adapted into a row mapper, mapping the first column of the result set. If neither a row or column mapper is registered, empty is returned.- Parameters:
type- the target qualified type to map to- Returns:
- a mapper for the given type, or empty if no row or column mapper is registered for the given type.
-
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<Mappers>- Returns:
- a copy of this configuration object.
-