Search in sources :

Example 1 with FormatProperty

use of org.simpleflatmapper.map.property.FormatProperty in project SimpleFlatMapper by arnaudroger.

the class FieldMapperToAppendableFactoryTest method testDoubleWithFormatterAppender.

@Test
public void testDoubleWithFormatterAppender() throws Exception {
    MappingContextFactoryBuilder<DbPrimitiveObjectWithSetter, CsvColumnKey> builder = getMappingContextBuilder();
    FieldMapperColumnDefinition<CsvColumnKey> format = FieldMapperColumnDefinition.<CsvColumnKey>identity().add(new FormatProperty(new DecimalFormat("0.0")));
    FieldMapper<DbPrimitiveObjectWithSetter, Appendable> fieldMapper = defaultFieldAppenderFactory.newFieldMapper(newPropertyMapping("pDouble", dbPrimitiveObjectClassMeta, format), builder, null);
    testFieldMapper("3.1", fieldMapper, dbPrimitiveObject, builder.newFactory());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) FormatProperty(org.simpleflatmapper.map.property.FormatProperty) DateFormatProperty(org.simpleflatmapper.map.property.DateFormatProperty) DecimalFormat(java.text.DecimalFormat) CsvColumnKey(org.simpleflatmapper.csv.CsvColumnKey) Test(org.junit.Test)

Aggregations

DecimalFormat (java.text.DecimalFormat)1 Test (org.junit.Test)1 CsvColumnKey (org.simpleflatmapper.csv.CsvColumnKey)1 DateFormatProperty (org.simpleflatmapper.map.property.DateFormatProperty)1 FormatProperty (org.simpleflatmapper.map.property.FormatProperty)1 DbPrimitiveObjectWithSetter (org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter)1