anchor.diff:  
   The method `GenericTypes.getErasedType` accepts a `java.lang.reflect.Type` and
   returns the raw `java.lang.Class` for that type. So if `type` were the generic
  -type `Pair<Foo,Bar>`, it would return `Foo.class`.
  +type `Pair<Foo,Bar>`, it would return `Pair.class`.
   
   Next, we extract the `L` and `R` generic parameters from the mapped type:
   
  
positive.code: }
  ----
  
  Note that we are creating an anonymous inner class that extends from
  `GenericType<T>`. At runtime, Jdbi inspects the generic type signature and
  extracts the `T` parameter for you.
  
  ==== Column Mappers
  
  Sometimes you only wish to fetch a single value, or need to build a larger
  object out of multiple individually mappable elements. A column mapper works on
  a single column instead of by row:
  
  [source,java,indent=0]
  ----
  include::{exampledir}/ResultsTest.java[tags=columnMapper]
  ----
  
  Notice how the ConstructorMapper, which usually would not know
  what to do with a custom *UserName* object, now automatically
  uses the column mapper to fill in the constructor parameter.
  
  TODO:
  
  * ColumnMapper is a functional interface. Demonstrate using column mapper
    lambda inline
  
  ===== ColumnMappers registry
  
  Out of the box, Jdbi supports mapping database columns to the following types:
  
  * Primitives: `boolean`, `byte`, `short`, `int`, `long`, `char`, `float`, and
    `double`
  
negative.code:   `OffsetDateTime`, `ZonedDateTime`, and `ZoneId`
  * java.util: `UUID`
  * `java.util.Collection` and Java arrays (for array columns). Some
    additional setup may be required depending on the type of array element--see
    <<SQL Arrays>>.
  
  ===== ColumnMapperFactory
  
  A link:{jdbidocs}/core/mapper/ColumnMapperFactory.html[ColumnMapperFactory^] can
  produce column mappers for arbitrary types.
  
  Implementing a factory might be preferable to a regular column mapper if:
  
  * The mapper class is generic, and could apply to multiple mapped types.
  * The type being mapped is generic, and/or the mapper could be composed
    from other registered mappers.
  * You want to bundle multiple mappers into a single class.
  
  Let's create a mapper factory for `Optional<T>` as an example. The factory
  should produce a `ColumnMapper<Optional<T>>` for any `T`, provided a column
  mapper is registered for `T`.
  
  Let's take this one step at a time:
  
  [source,java]
  ----
  public class OptionalColumnMapperFactory implements ColumnMapperFactory {
    public Optional<ColumnMapper<?>> build(Type type, ConfigRegistry config) {
      ...
    }
  }
  ----
  
  The `build` method accepts a mapped type, and a config registry. It may return
  `Optional.of(someMapper)` if it knows how to map that type, or
  `Optional.empty()` otherwise.
  
  First, we check whether the mapped type is an `Optional`:
  
  [source,java]
  ----
  if (!Optional.class.equals(GenericTypes.getErasedType(type))) {
    return Optional.empty();
  }
  ----
  
  The link:{jdbidocs}/core/generic/GenericTypes.html[GenericTypes^] utility class
  provides several methods for helping to interpret Java generic types.
  
  The method `GenericTypes.getErasedType` accepts a `java.lang.reflect.Type` and
  returns the raw `java.lang.Class` for that type. So if `type` were the generic
  type `Optional<String>`, it would return `Optional.class`.
  
  Next, we extract the `T` generic parameter from the mapped type:
  
  [source,java]
  ----
  Type embeddedType = GenericTypes.resolveType(Optional.class.getTypeParameters()[0], type);
  ----
  
  The `GenericTypes.resolveType` method accepts a generic type parameter to
  resolve, and a context type in which to resolve it.
  
  The expression `Optional.class.getTypeParameters()[0]` gives the type variable
  `T`. So if `type` was `Optional<String>`, the call to `resolveType` means
  "resolve the type variable `T` in the context of `Optional<String>`, which
  resolves to the type `Foo`.
  
  Now that we have the type of `T`, we can look up a column mapper for that type
  from the `ColumnMappers` config class, through the config registry:
  
  [source,java]
  ----
  ColumnMapper<?> embeddedMapper = config.get(ColumnMappers.class)
      .findFor(embeddedType)
      .orElseThrow(() -> new NoSuchMapperException(
          "No column mapper registered for parameter " + embeddedType + " of type " + type));
  ----
  
  The config registry is a locator for config classes. So when we call
  `config.get(ColumnMappers.class)`, we get back a `ColumnMappers` instance with
  the current column mapper configuration.
  
  Next we call `ColumnMappers.findFor()` to get the column mappers for the left
  and right type parameters.
  
  [TIP]
  You may have noticed that although this method can return `Optional`, we're
  throwing an exception if we can't find a mapper for the embedded type. We've
  found this to be a best practice: return `Optional.empty()` if the factory knows
  nothing about the mapped type (`Optional`, in this case). If it knows the mapped
  type but is missing some configuration to make it work (e.g. no mapper
  registered for tye `T` parameter) it is more helpful to throw an exception with
  an informative message, so users can diagnose _why_ the mapper isn't working as
  expected.
  
  Finally, we construct the column mapper for optionals, and return it:
  
  [source,java]
  ----
  ColumnMapper<?> optionalMapper = (rs, col, ctx) ->
      Optional.ofNullable(embeddedMapper.map(rs, col, ctx));
  
  return Optional.of(optionalMapper);
  ----
  
  Here is the factory class all together:
  
  [source,java]
  ----
  public class OptionalColumnMapperFactory implements ColumnMapperFactory {
    public Optional<ColumnMapper<?>> build(Type type, ConfigRegistry config) {
      if (!Optional.class.equals(GenericTypes.getErasedType(type))) {
        return Optional.empty();
      }
  
      Type t = GenericTypes.resolveType(Optional.class.getTypeParameters()[0], type);
  
      ColumnMapper<?> embeddedMapper = config.get(ColumnMappers.class)
          .findFor(t)
          .orElseThrow(() -> new NoSuchMapperException(
              "No column mapper registered for parameter " + t + " of type " + type));
  
      ColumnMapper<?> optionalMapper = (rs, col, ctx) ->
          Optional.ofNullable(embeddedMapper.map(rs, col, ctx));
  
      return Optional.of(optionalMapper);
    }
  }
  ----
  
  Column mapper factories may be registered similar to regular column mappers:
  
  [source,java]
  ----
  jdbi.registerColumnMapper(new OptionalColumnMapperFactory());
  ----
  
  But how can we map to `Optional<String>`? Java doesn't provide a type-safe way
  to pass around generic types.
  
  For this, Jdbi provides a `GenericType<T>` class:
  
  [source,java]
  ----
  try (Handle handle = jdbi.open()) {
    List<Optional<String>> middleNames = handle
            .createQuery("select middle_name from contacts")
            .mapTo(new GenericType<Optional<String>>() {})
            .list();
  }
  ----
  
  Note that the expression `new GenericType<Optional<String>>() {}` creates an
  anonymous inner class that extends from `GenericType<T>`. At runtime, Jdbi
  inspects the generic type signature and extracts the `T` parameter for you.
  
  ==== Reflection Mappers
  
  