private static Optional<RowMapper<?>> create(Type type, ConfigRegistry config) {
        return config.get(RowMappers.class).findFor(
                GenericTypes.findGenericParameter(type, Optional.class)
                    .orElseThrow(() -> new NoSuchMapperException("No mapper for raw Optional type")))
            .map(mapper -> (r, ctx) -> Optional.ofNullable(mapper.map(r, ctx)));
    }
Row mapper factory which knows how to map row elements wrapped in an Optional.
core/src/main/java/org/jdbi/v3/core/mapper/OptionalRowMapperFactory.java