Merge branch '5.3.x'
This commit is contained in:
commit
267df1c0f2
|
|
@ -130,28 +130,6 @@ public class FormattingConversionServiceTests {
|
||||||
assertThat(formattingService.convert("", TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(Integer.class))).isNull();
|
assertThat(formattingService.convert("", TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(Integer.class))).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void registerDefaultValueViaFormatter() {
|
|
||||||
registerDefaultValue(Date.class, new Date());
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T> void registerDefaultValue(Class<T> clazz, final T defaultValue) {
|
|
||||||
formattingService.addFormatterForFieldType(clazz, new Formatter<T>() {
|
|
||||||
@Override
|
|
||||||
public T parse(String text, Locale locale) {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String print(T t, Locale locale) {
|
|
||||||
return defaultValue.toString();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return defaultValue.toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void introspectedFormatter() {
|
public void introspectedFormatter() {
|
||||||
formattingService.addFormatter(new NumberStyleFormatter("#,#00.0#"));
|
formattingService.addFormatter(new NumberStyleFormatter("#,#00.0#"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue