updated CustomEditorConfigurer example to recommended style (SPR-5971)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2837 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
906024145a
commit
812b26b932
|
|
@ -636,18 +636,8 @@ package example;
|
||||||
|
|
||||||
public class ExoticTypeEditor extends PropertyEditorSupport {
|
public class ExoticTypeEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
private String format;
|
|
||||||
|
|
||||||
public void setFormat(String format) {
|
|
||||||
this.format = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAsText(String text) {
|
public void setAsText(String text) {
|
||||||
if (format != null && format.equals("upperCase")) {
|
setValue(new ExoticType(text.toUpperCase()));
|
||||||
text = text.toUpperCase();
|
|
||||||
}
|
|
||||||
ExoticType type = new ExoticType(text);
|
|
||||||
setValue(type);
|
|
||||||
}
|
}
|
||||||
}]]></programlisting>
|
}]]></programlisting>
|
||||||
<para>Finally, we use <classname>CustomEditorConfigurer</classname> to register the new
|
<para>Finally, we use <classname>CustomEditorConfigurer</classname> to register the new
|
||||||
|
|
@ -656,11 +646,7 @@ public class ExoticTypeEditor extends PropertyEditorSupport {
|
||||||
<programlisting language="xml"><![CDATA[<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
<programlisting language="xml"><![CDATA[<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
||||||
<property name="customEditors">
|
<property name="customEditors">
|
||||||
<map>
|
<map>
|
||||||
<entry key="example.ExoticType">
|
<entry key="example.ExoticType" value="example.ExoticTypeEditor"/>
|
||||||
<bean class="example.ExoticTypeEditor">
|
|
||||||
<property name="format" value="upperCase"/>
|
|
||||||
</bean>
|
|
||||||
</entry>
|
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
</bean>]]></programlisting>
|
</bean>]]></programlisting>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue