@ -1056,13 +1095,11 @@ public class DecimalAnnotationFormatterFactory implements AnnotationFormatterFac
@@ -1056,13 +1095,11 @@ public class DecimalAnnotationFormatterFactory implements AnnotationFormatterFac
}
}
]]>
</programlisting>
<para>
Then, to trigger, simply annotate a property as a @DecimalFormat in your model:
</para>
<programlistinglanguage="java"><![CDATA[
package example.app;
</programlisting>
<para>
Then, to trigger, simply annotate a property as a @DecimalFormat in your model:
</para>
<programlistinglanguage="java"><![CDATA[
public class MyModel {
@DecimalFormat("#,###")
@ -1070,12 +1107,13 @@ public class MyModel {
@@ -1070,12 +1107,13 @@ public class MyModel {
}
]]>
</programlisting>
</programlisting>
</section>
</section>
<sectionid="ui-format-FormatterRegistry-SPI">
<title>FormatterRegistry SPI</title>
<para>
Formatters are typically registered in a FormatterRegistry.
Formatters can be registered in a FormatterRegistry.
A DataBinder uses this registry to resolve the Formatter to use for a specific field.
This allows you to configure default Formatting rules centrally, rather than duplicating such configuration across your UI Controllers.
For example, you might want to enforce that all Date fields are formatted a certain way, or fields with a specific annotation are formatted in a certain way.
@ -1085,6 +1123,8 @@ public class MyModel {
@@ -1085,6 +1123,8 @@ public class MyModel {
Review the FormatterRegistry SPI below:
</para>
<programlistinglanguage="java"><![CDATA[
package org.springframework.ui.format;
public interface FormatterRegistry {
void add(Formatter<?> formatter);
@ -1121,7 +1161,7 @@ public interface FormatterRegistry {
@@ -1121,7 +1161,7 @@ public interface FormatterRegistry {