protected void setUp() { field = new Field(); field.setProperty(BIG_DECIMAL_PROPERTY); oldConverter = ConvertUtils.lookup(BigDecimal.class); ConvertUtils.register(new BigDecimalConverter(null), BigDecimal.class); }
/** * Returns a {@link Converter} that can convert values to the target value type. If the target * entity type + property has a custom converter defined in the GTFS entity schema, we will use * that as instead. * * @param targetEntityType the target entity type whose property will be updated. * @param targetPropertyName the target property name for the property that will be updated on the * target entity. * @param targetValueType the target value type we wish to convert to */ public Converter resolveConverter( Class<?> targetEntityType, String targetPropertyName, Class<?> targetValueType) { SingleFieldMapping mapping = _schemaCache.getFieldMappingForCsvFieldName(targetEntityType, targetPropertyName); if (mapping == null) { mapping = _schemaCache.getFieldMappingForObjectFieldName(targetEntityType, targetPropertyName); } if (mapping != null) { if (mapping instanceof ConverterFactory) { ConverterFactory factory = (ConverterFactory) mapping; return factory.create(_reader.getContext()); } if (mapping instanceof Converter) { return (Converter) mapping; } } return ConvertUtils.lookup(targetValueType); }