/** * Will create a DynamicMapper on the specified type. * @param target the type * @param <T> the jdbcMapper target type * @return the DynamicMapper */ public <T> DynamicJdbcMapper<T> newMapper(final Type target) { final ClassMeta<T> classMeta = getClassMeta(target); return new DynamicJdbcSetRowMapper<T>(new SetRowMapperFactory<T>(classMeta), new MapperKeyFactory(), new MapperKeyFactory()); }
public <T> JdbcSourceFieldMapper<T> newSourceFieldMapper(Type target) { final ClassMeta<T> classMeta = getClassMeta(target); return new DynamicJdbSourceFieldMapper<T>(new SourceFieldMapperFactory<T>(classMeta), new MapperKeyFactory()); } public static class DynamicJdbSourceFieldMapper<T>
/** * add a new mapping to the specified property with the specified index, the specified type. * * @param column the property name * @param index the property index * @param sqlType the property type, @see java.sql.Types * @param properties the property properties * @return the current builder */ public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType, Object... properties) { return addMapping(new JdbcColumnKey(column, index, sqlType), properties); }
@Test public void test544() { final String VALUES_VAL = "values_val"; final String VALUES = "values"; JdbcColumnKey valuesKeys = new JdbcColumnKey(VALUES, 1, Types.VARCHAR); JdbcMapperFactory .newInstance() .addAlias(VALUES, VALUES_VAL) .newBuilder(C544.class) .addMapping(valuesKeys) .mapper(); }
/** * Will create a newInstance of JdbcMapper based on the specified metadata and the target class. * @param target the target class of the jdbcMapper * @param metaData the metadata to create the jdbcMapper from * @param <T> the jdbcMapper target type * @return a jdbcMapper that will map the data represented by the metadata to an newInstance of target * @throws java.sql.SQLException if an error occurs getting the metaData */ public <T> JdbcMapper<T> newMapper(final Class<T> target, final ResultSetMetaData metaData) throws SQLException { JdbcMapperBuilder<T> builder = newBuilder(target); builder.addMapping(metaData); return builder.mapper(); }
public <P> ConnectedSelectQuery<T, P> where(final String whereClause, final Type paramClass) { SelectQuery<T, P> selectQuery = delegate.where(whereClause, paramClass); return new ConnectedSelectQuery<T, P>(selectQuery, transactionTemplate); }
public <T> JdbcMapperBuilder<T> newBuilder(ClassMeta<T> classMeta) { MapperConfig<JdbcColumnKey, ResultSet> mapperConfig = mapperConfig(); return new JdbcMapperBuilder<T>( classMeta, mapperConfig, getterFactory, new JdbcMappingContextFactoryBuilder(!mapperConfig.unorderedJoin())); }
/** * Add a discriminator value with its associated type. * @param value the value * @param type the type * @return the current builder */ public DiscriminatorJdbcSubBuilder when(String value, Type type) { return when(new DiscriminatorPredicate(value), type); }
@Override public MappingContext<? super ResultSet> newMappingContext(ResultSet resultSet) throws SQLException { return ((JdbcSourceFieldMapper<T>)getMapper(resultSet)).newMappingContext(resultSet); } }
/** * add a new mapping to the specified property with the specified index, the specified type. * * @param column the property name * @param index the property index * @param sqlType the property type, @see java.sql.Types * @param columnDefinition the property definition * @return the current builder */ public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType, FieldMapperColumnDefinition<JdbcColumnKey> columnDefinition) { return addMapping(new JdbcColumnKey(column, index, sqlType), columnDefinition); }
/** * Will create a DynamicMapper on the specified type. * @param target the type * @param <T> the jdbcMapper target type * @return the DynamicMapper */ public <T> DynamicJdbcMapper<T> newMapper(final Type target) { final ClassMeta<T> classMeta = getClassMeta(target); return new DynamicJdbcSetRowMapper<T>(new SetRowMapperFactory<T>(classMeta), new MapperKeyFactory(), new MapperKeyFactory()); }
public <T> JdbcSourceFieldMapper<T> newSourceFieldMapper(Type target) { final ClassMeta<T> classMeta = getClassMeta(target); return new DynamicJdbSourceFieldMapper<T>(new SourceFieldMapperFactory<T>(classMeta), new MapperKeyFactory()); } public static class DynamicJdbSourceFieldMapper<T>
/** * Add a discriminator value with its associated type. * @param value the value * @param type the type * @return the current builder */ public DiscriminatorJdbcSubBuilder when(String value, Type type) { return when(new DiscriminatorPredicate(value), type); }
@Override public MappingContext<? super ResultSet> newMappingContext(ResultSet resultSet) throws SQLException { return ((JdbcSourceFieldMapper<T>)getMapper(resultSet)).newMappingContext(resultSet); } }
/** * add a new mapping to the specified property with the specified index, the specified type. * * @param column the property name * @param index the property index * @param sqlType the property type, @see java.sql.Types * @param properties the property properties * @return the current builder */ public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType, Object... properties) { return addMapping(new JdbcColumnKey(column, index, sqlType), properties); }
/** * add a new mapping to the specified property with the specified index, the specified type. * * @param column the property name * @param index the property index * @param sqlType the property type, @see java.sql.Types * @param columnDefinition the property definition * @return the current builder */ public JdbcMapperBuilder<T> addMapping(final String column, final int index, final int sqlType, FieldMapperColumnDefinition<JdbcColumnKey> columnDefinition) { return addMapping(new JdbcColumnKey(column, index, sqlType), columnDefinition); }