Search in sources :

Example 1 with LongFieldMapper

use of org.simpleflatmapper.map.fieldmapper.LongFieldMapper in project SimpleFlatMapper by arnaudroger.

the class ResultSetFieldMapperFactoryTest method testPrimitiveField.

@Test
public void testPrimitiveField() {
    ClassMeta<DbObject> classMeta = ReflectionService.newInstance(false).getClassMeta(DbObject.class);
    PropertyMeta<DbObject, Long> id = classMeta.newPropertyFinder(ConstantPredicate.<PropertyMeta<?, ?>>truePredicate()).<Long>findProperty(new DefaultPropertyNameMatcher("id", 0, false, false), new Object[0]);
    FieldMapperColumnDefinition<JdbcColumnKey> identity = FieldMapperColumnDefinition.identity();
    PropertyMapping<DbObject, Long, JdbcColumnKey, FieldMapperColumnDefinition<JdbcColumnKey>> propertyMapping = new PropertyMapping<DbObject, Long, JdbcColumnKey, FieldMapperColumnDefinition<JdbcColumnKey>>(id, new JdbcColumnKey("id", 1), identity);
    FieldMapper<ResultSet, DbObject> fieldMapper = factory.newFieldMapper(propertyMapping, null, RethrowMapperBuilderErrorHandler.INSTANCE);
    assertTrue(fieldMapper instanceof LongFieldMapper);
    PropertyMapping<DbObject, Long, JdbcColumnKey, FieldMapperColumnDefinition<JdbcColumnKey>> propertyMapping1 = new PropertyMapping<DbObject, Long, JdbcColumnKey, FieldMapperColumnDefinition<JdbcColumnKey>>(id, new JdbcColumnKey("id", 0), identity);
    fieldMapper = factory.newFieldMapper(propertyMapping1, null, RethrowMapperBuilderErrorHandler.INSTANCE);
    assertTrue(fieldMapper instanceof LongFieldMapper);
}
Also used : FieldMapperColumnDefinition(org.simpleflatmapper.map.property.FieldMapperColumnDefinition) LongFieldMapper(org.simpleflatmapper.map.fieldmapper.LongFieldMapper) DbObject(org.simpleflatmapper.test.beans.DbObject) DefaultPropertyNameMatcher(org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher) JdbcColumnKey(org.simpleflatmapper.jdbc.JdbcColumnKey) PropertyMapping(org.simpleflatmapper.map.mapper.PropertyMapping) ResultSet(java.sql.ResultSet) PropertyMeta(org.simpleflatmapper.reflect.meta.PropertyMeta) Test(org.junit.Test)

Aggregations

ResultSet (java.sql.ResultSet)1 Test (org.junit.Test)1 JdbcColumnKey (org.simpleflatmapper.jdbc.JdbcColumnKey)1 LongFieldMapper (org.simpleflatmapper.map.fieldmapper.LongFieldMapper)1 PropertyMapping (org.simpleflatmapper.map.mapper.PropertyMapping)1 FieldMapperColumnDefinition (org.simpleflatmapper.map.property.FieldMapperColumnDefinition)1 DefaultPropertyNameMatcher (org.simpleflatmapper.reflect.meta.DefaultPropertyNameMatcher)1 PropertyMeta (org.simpleflatmapper.reflect.meta.PropertyMeta)1 DbObject (org.simpleflatmapper.test.beans.DbObject)1