From ff7f3aebeae97d6a35913eeb389a885af72c4e28 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Fri, 4 Feb 2011 18:20:05 +0000 Subject: [PATCH] reordered interface operations for clarity --- .../format/FormatterRegistry.java | 16 ++++++++-------- .../support/FormattingConversionService.java | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/format/FormatterRegistry.java b/org.springframework.context/src/main/java/org/springframework/format/FormatterRegistry.java index f5f15a4140..09d9a4a2a0 100644 --- a/org.springframework.context/src/main/java/org/springframework/format/FormatterRegistry.java +++ b/org.springframework.context/src/main/java/org/springframework/format/FormatterRegistry.java @@ -29,6 +29,14 @@ import org.springframework.core.convert.converter.ConverterRegistry; */ public interface FormatterRegistry extends ConverterRegistry { + /** + * Adds a Formatter to format fields of a specific type. + * The field type is implied by the parameterized Formatter instance. + * @param formatter the formatter to add + * @see #addFormatterForFieldType(Class, Formatter) + */ + void addFormatter(Formatter formatter); + /** * Adds a Formatter to format fields of the given type. *

On print, if the Formatter's type T is declared and fieldType is not assignable to T, @@ -40,14 +48,6 @@ public interface FormatterRegistry extends ConverterRegistry { */ void addFormatterForFieldType(Class fieldType, Formatter formatter); - /** - * Adds a Formatter to format fields of a specific type. - * The field type is implied by the parameterized Formatter instance. - * @param formatter the formatter to add - * @see #addFormatterForFieldType(Class, Formatter) - */ - void addFormatter(Formatter formatter); - /** * Adds a Printer/Parser pair to format fields of a specific type. * The formatter will delegate to the specified printer for printing diff --git a/org.springframework.context/src/main/java/org/springframework/format/support/FormattingConversionService.java b/org.springframework.context/src/main/java/org/springframework/format/support/FormattingConversionService.java index 852bc77d90..f47bceed28 100644 --- a/org.springframework.context/src/main/java/org/springframework/format/support/FormattingConversionService.java +++ b/org.springframework.context/src/main/java/org/springframework/format/support/FormattingConversionService.java @@ -63,11 +63,6 @@ public class FormattingConversionService extends GenericConversionService } - public void addFormatterForFieldType(Class fieldType, Formatter formatter) { - addConverter(new PrinterConverter(fieldType, formatter, this)); - addConverter(new ParserConverter(fieldType, formatter, this)); - } - public void addFormatter(Formatter formatter) { final Class fieldType = GenericTypeResolver.resolveTypeArgument(formatter.getClass(), Formatter.class); if (fieldType == null) { @@ -76,6 +71,11 @@ public class FormattingConversionService extends GenericConversionService } addFormatterForFieldType(fieldType, formatter); } + + public void addFormatterForFieldType(Class fieldType, Formatter formatter) { + addConverter(new PrinterConverter(fieldType, formatter, this)); + addConverter(new ParserConverter(fieldType, formatter, this)); + } public void addFormatterForFieldType(Class fieldType, Printer printer, Parser parser) { addConverter(new PrinterConverter(fieldType, printer, this));