Skip to content

Commit ff7f3ae

Browse files
author
Keith Donald
committed
reordered interface operations for clarity
1 parent 7d1104e commit ff7f3ae

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

org.springframework.context/src/main/java/org/springframework/format/FormatterRegistry.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
*/
3030
public interface FormatterRegistry extends ConverterRegistry {
3131

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+
3240
/**
3341
* Adds a Formatter to format fields of the given type.
3442
* <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 {
4048
*/
4149
void addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter);
4250

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-
5151
/**
5252
* Adds a Printer/Parser pair to format fields of a specific type.
5353
* The formatter will delegate to the specified <code>printer</code> for printing

org.springframework.context/src/main/java/org/springframework/format/support/FormattingConversionService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ public void setEmbeddedValueResolver(StringValueResolver resolver) {
6363
}
6464

6565

66-
public void addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter) {
67-
addConverter(new PrinterConverter(fieldType, formatter, this));
68-
addConverter(new ParserConverter(fieldType, formatter, this));
69-
}
70-
7166
public void addFormatter(Formatter<?> formatter) {
7267
final Class<?> fieldType = GenericTypeResolver.resolveTypeArgument(formatter.getClass(), Formatter.class);
7368
if (fieldType == null) {
@@ -76,6 +71,11 @@ public void addFormatter(Formatter<?> formatter) {
7671
}
7772
addFormatterForFieldType(fieldType, formatter);
7873
}
74+
75+
public void addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter) {
76+
addConverter(new PrinterConverter(fieldType, formatter, this));
77+
addConverter(new ParserConverter(fieldType, formatter, this));
78+
}
7979

8080
public void addFormatterForFieldType(Class<?> fieldType, Printer<?> printer, Parser<?> parser) {
8181
addConverter(new PrinterConverter(fieldType, printer, this));

0 commit comments

Comments
 (0)