Class RowMappers
java.lang.Object
org.jdbi.v3.core.mapper.RowMappers
- All Implemented Interfaces:
JdbiConfig<RowMappers>
Configuration registry for
RowMapperFactory
instances.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this configuration object.Obtain a row mapper for the given type in the given context.Obtain a row mapper for the given type in the given context.findFor
(GenericType<T> type) Obtain a row mapper for the given type in the given context.Returns theJdbiInterceptionChainHolder
for the RowMapper inference.Register a row mapper for a given type.<T> RowMappers
register
(GenericType<T> type, RowMapper<T> mapper) Register a row mapper for a given type.Register a row mapper which will have its parameterized type inspected to determine what it maps to.register
(RowMapperFactory factory) Register a row mapper factory.void
setRegistry
(ConfigRegistry registry) The registry will inject itself into the configuration object.
-
Constructor Details
-
RowMappers
public RowMappers()
-
-
Method Details
-
setRegistry
Description copied from interface:JdbiConfig
The 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:
setRegistry
in interfaceJdbiConfig<RowMappers>
- Parameters:
registry
- the registry that owns this configuration object
-
getInferenceInterceptors
Returns theJdbiInterceptionChainHolder
for the RowMapper inference. This chain allows registration of custom interceptors to change the standard type inference for theregister(RowMapper)
method. -
register
Register a row mapper which will have its parameterized type inspected to determine what it maps to. Will be used withResultBearing.mapTo(Class)
for registered mappings.The parameter must be concretely parameterized, we use the type argument T to determine if it applies to a given type.
Object
is not supported as a concrete parameter type.- Parameters:
mapper
- the row mapper- Returns:
- this
- Throws:
UnsupportedOperationException
- if the RowMapper is not a concretely parameterized type
-
register
Register a row mapper for a given type.- Type Parameters:
T
- the type- Parameters:
type
- the type to match with equals.mapper
- the row mapper- Returns:
- this
-
register
Register a row mapper for a given type.- Parameters:
type
- the type to match with equals.mapper
- the row mapper- Returns:
- this
-
register
Register a row mapper factory.Will be used with
ResultBearing.mapTo(Class)
for registered mappings.- Parameters:
factory
- the row mapper factory- Returns:
- this
-
findFor
Obtain a row mapper for the given type in the given context.- Type Parameters:
T
- the type of the mapper to find- Parameters:
type
- the target type to map to- Returns:
- a RowMapper for the given type, or empty if no row mapper is registered for the given type.
-
findFor
Obtain a row mapper for the given type in the given context.- Type Parameters:
T
- the type of the mapper to find- Parameters:
type
- the target type to map to- Returns:
- a RowMapper for the given type, or empty if no row mapper is registered for the given type.
-
findFor
-
createCopy
Description copied from interface:JdbiConfig
Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopy
in interfaceJdbiConfig<RowMappers>
- Returns:
- a copy of this configuration object.
-