use of org.simpleflatmapper.reflect.meta.ObjectPropertyMeta in project SimpleFlatMapper by arnaudroger.
the class AbstractConstantTargetMapperBuilder method addColumn.
@SuppressWarnings("unchecked")
public B addColumn(K key, FieldMapperColumnDefinition<K> columnDefinition) {
final FieldMapperColumnDefinition<K> composedDefinition = columnDefinition.compose(mapperConfig.columnDefinitions().getColumnDefinition(key));
final K mappedColumnKey = composedDefinition.rename(key);
if (composedDefinition.has(ConstantValueProperty.class)) {
ConstantValueProperty staticValueProperty = composedDefinition.lookFor(ConstantValueProperty.class);
PropertyMeta<T, Object> meta = new ObjectPropertyMeta<T, Object>(key.getName(), classMeta.getType(), reflectionService, staticValueProperty.getType(), ScoredGetter.of(new ConstantGetter<T, Object>(staticValueProperty.getValue()), 1), null, null);
propertyMappingsBuilder.addProperty(key, columnDefinition, meta);
} else {
propertyMappingsBuilder.addProperty(mappedColumnKey, composedDefinition);
}
return (B) this;
}
use of org.simpleflatmapper.reflect.meta.ObjectPropertyMeta in project SimpleFlatMapper by arnaudroger.
the class SqlParameterSourceBuilder method add.
public SqlParameterSourceBuilder<T> add(JdbcColumnKey key, FieldMapperColumnDefinition<JdbcColumnKey> columnDefinition) {
final FieldMapperColumnDefinition<JdbcColumnKey> composedDefinition = columnDefinition.compose(mapperConfig.columnDefinitions().getColumnDefinition(key));
final JdbcColumnKey mappedColumnKey = composedDefinition.rename(key);
if (composedDefinition.has(ConstantValueProperty.class)) {
ConstantValueProperty staticValueProperty = composedDefinition.lookFor(ConstantValueProperty.class);
PropertyMeta<T, Object> meta = new ObjectPropertyMeta<T, Object>(key.getName(), builder.getClassMeta().getType(), reflectionService, staticValueProperty.getType(), ScoredGetter.of(new ConstantGetter<T, Object>(staticValueProperty.getValue()), 1), null, null);
builder.addProperty(key, columnDefinition, meta);
} else {
builder.addProperty(mappedColumnKey, composedDefinition);
}
return this;
}
Aggregations