@ -1056,13 +1095,11 @@ public class DecimalAnnotationFormatterFactory implements AnnotationFormatterFac
}
}
}
}
]]>
]]>
</programlisting>
</programlisting>
<para>
<para>
Then, to trigger, simply annotate a property as a @DecimalFormat in your model:
Then, to trigger, simply annotate a property as a @DecimalFormat in your model:
</para>
</para>
<programlistinglanguage="java"><![CDATA[
<programlistinglanguage="java"><![CDATA[
package example.app;
public class MyModel {
public class MyModel {
@DecimalFormat("#,###")
@DecimalFormat("#,###")
@ -1070,12 +1107,13 @@ public class MyModel {
}
}
]]>
]]>
</programlisting>
</programlisting>
</section>
</section>
</section>
<sectionid="ui-format-FormatterRegistry-SPI">
<sectionid="ui-format-FormatterRegistry-SPI">
<title>FormatterRegistry SPI</title>
<title>FormatterRegistry SPI</title>
<para>
<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.
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.
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.
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 {
Review the FormatterRegistry SPI below:
Review the FormatterRegistry SPI below:
</para>
</para>
<programlistinglanguage="java"><![CDATA[
<programlistinglanguage="java"><![CDATA[
package org.springframework.ui.format;
public interface FormatterRegistry {
public interface FormatterRegistry {
void add(Formatter<?> formatter);
void add(Formatter<?> formatter);
@ -1121,7 +1161,7 @@ public interface FormatterRegistry {