Skip to content

Commit 6ffb750

Browse files
committed
updated CustomEditorConfigurer example to recommended style (SPR-5971)
1 parent d9ed1e9 commit 6ffb750

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

spring-framework-reference/src/validation.xml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -636,18 +636,8 @@ package example;
636636
637637
public class ExoticTypeEditor extends PropertyEditorSupport {
638638
639-
private String format;
640-
641-
public void setFormat(String format) {
642-
this.format = format;
643-
}
644-
645639
public void setAsText(String text) {
646-
if (format != null && format.equals("upperCase")) {
647-
text = text.toUpperCase();
648-
}
649-
ExoticType type = new ExoticType(text);
650-
setValue(type);
640+
setValue(new ExoticType(text.toUpperCase()));
651641
}
652642
}]]></programlisting>
653643
<para>Finally, we use <classname>CustomEditorConfigurer</classname> to register the new
@@ -656,11 +646,7 @@ public class ExoticTypeEditor extends PropertyEditorSupport {
656646
<programlisting language="xml"><![CDATA[<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
657647
<property name="customEditors">
658648
<map>
659-
<entry key="example.ExoticType">
660-
<bean class="example.ExoticTypeEditor">
661-
<property name="format" value="upperCase"/>
662-
</bean>
663-
</entry>
649+
<entry key="example.ExoticType" value="example.ExoticTypeEditor"/>
664650
</map>
665651
</property>
666652
</bean>]]></programlisting>

0 commit comments

Comments
 (0)