This commit is contained in:
Keith Donald 2009-09-03 04:41:37 +00:00
parent 354e6fafe9
commit 421aab0fa5
1 changed files with 4 additions and 4 deletions

View File

@ -978,8 +978,8 @@ public class Money {
<section id="ui-format-AnnotationFormatterFactory"> <section id="ui-format-AnnotationFormatterFactory">
<title>Custom Format Annotations</title> <title>Custom Format Annotations</title>
<para> <para>
The presence of field or method annotations on properties of your model objects can also trigger field-specific formatting logic. Field-specific formatting can be triggered by annotating model properties.
Bind a custom annotation to a Formatter instance by implementing an AnnotationFormatterFactory: To bind a custom annotation to a Formatter instance, implement a AnnotationFormatterFactory:
</para> </para>
<programlisting language="java"><![CDATA[ <programlisting language="java"><![CDATA[
package org.springframework.ui.format; package org.springframework.ui.format;
@ -991,7 +991,7 @@ public interface AnnotationFormatterFactory<A extends Annotation, T> {
</programlisting> </programlisting>
<para> <para>
The example implementation below binds a custom @DecimalFormat annotation to a Number Formatter instance. The example implementation below binds a custom @DecimalFormat annotation to a Number Formatter instance.
This annotation allows the format pattern to be configured as its value. This particular annotation allows the format pattern to be configured.
</para> </para>
<programlisting language="java"><![CDATA[ <programlisting language="java"><![CDATA[
package example.format; package example.format;
@ -1007,7 +1007,7 @@ public class DecimalAnnotationFormatterFactory implements AnnotationFormatterFac
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Then, to trigger somewhere in your model: Then, to trigger this custom Number formatting, simply annotate a property as a @DecimalFormat in your model:
</para> </para>
<programlisting language="java"><![CDATA[ <programlisting language="java"><![CDATA[
package example.app; package example.app;