|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -321,28 +321,6 @@ public class FormattingConversionServiceTests {
@@ -321,28 +321,6 @@ public class FormattingConversionServiceTests {
|
|
|
|
|
TypeDescriptor.valueOf(String.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@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 |
|
|
|
|
public void introspectedFormatter() { |
|
|
|
|
formattingService.addFormatter(new NumberStyleFormatter("#,#00.0#")); |
|
|
|
|