Description
This patch allows you to configure a PropertyEditor for any property. For example, if you annotate a property as follows:
/**
- Sets the amount of beer remaining in the keg (in ml)
- @org.apache.xbean.Property propertyEditor="org.apache.xbean.spring.example.MilliLittersPropertyEditor"
- @param remaining
*/
public void setRemaining(long remaining) { this.remaining = remaining; }
Then when you configure the value of the 'remaining' property in xbean then the MilliLittersPropertyEditor will be used to convert the string value to a long. In the test case, our MilliLittersPropertyEditor can handle converting different units of measurement to ml. For example:
<beans xmlns:x="http://xbean.apache.org/schemas/pizza">
<x:keg id="ml1000" remaining="1000 ml"/>
<x:keg id="pints5" remaining="5 pints"/>
<x:keg id="liter20" remaining="20 liter"/>
<x:keg id="empty" remaining="0"/>
</beans>