File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed
org.springframework.context/src/main/java/org/springframework/format Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 29
29
*/
30
30
public interface FormatterRegistry extends ConverterRegistry {
31
31
32
+ /**
33
+ * Adds a Formatter to format fields of a specific type.
34
+ * The field type is implied by the parameterized Formatter instance.
35
+ * @param formatter the formatter to add
36
+ * @see #addFormatterForFieldType(Class, Formatter)
37
+ */
38
+ void addFormatter (Formatter <?> formatter );
39
+
32
40
/**
33
41
* Adds a Formatter to format fields of the given type.
34
42
* <p>On print, if the Formatter's type T is declared and <code>fieldType</code> is not assignable to T,
@@ -40,14 +48,6 @@ public interface FormatterRegistry extends ConverterRegistry {
40
48
*/
41
49
void addFormatterForFieldType (Class <?> fieldType , Formatter <?> formatter );
42
50
43
- /**
44
- * Adds a Formatter to format fields of a specific type.
45
- * The field type is implied by the parameterized Formatter instance.
46
- * @param formatter the formatter to add
47
- * @see #addFormatterForFieldType(Class, Formatter)
48
- */
49
- void addFormatter (Formatter <?> formatter );
50
-
51
51
/**
52
52
* Adds a Printer/Parser pair to format fields of a specific type.
53
53
* The formatter will delegate to the specified <code>printer</code> for printing
Original file line number Diff line number Diff line change @@ -63,11 +63,6 @@ public void setEmbeddedValueResolver(StringValueResolver resolver) {
63
63
}
64
64
65
65
66
- public void addFormatterForFieldType (Class <?> fieldType , Formatter <?> formatter ) {
67
- addConverter (new PrinterConverter (fieldType , formatter , this ));
68
- addConverter (new ParserConverter (fieldType , formatter , this ));
69
- }
70
-
71
66
public void addFormatter (Formatter <?> formatter ) {
72
67
final Class <?> fieldType = GenericTypeResolver .resolveTypeArgument (formatter .getClass (), Formatter .class );
73
68
if (fieldType == null ) {
@@ -76,6 +71,11 @@ public void addFormatter(Formatter<?> formatter) {
76
71
}
77
72
addFormatterForFieldType (fieldType , formatter );
78
73
}
74
+
75
+ public void addFormatterForFieldType (Class <?> fieldType , Formatter <?> formatter ) {
76
+ addConverter (new PrinterConverter (fieldType , formatter , this ));
77
+ addConverter (new ParserConverter (fieldType , formatter , this ));
78
+ }
79
79
80
80
public void addFormatterForFieldType (Class <?> fieldType , Printer <?> printer , Parser <?> parser ) {
81
81
addConverter (new PrinterConverter (fieldType , printer , this ));
You can’t perform that action at this time.
0 commit comments