Uploaded image for project: 'XBean'
  1. XBean
  2. XBEAN-36

[RTC] Support annotating properties with the ProperyEditor that should be used when wiring in the value.

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.6
    • spring
    • None

    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>

      Attachments

        1. XBEAN-36.patch
          26 kB
          Hiram R. Chirino

        Activity

          People

            chirino Hiram R. Chirino
            chirino Hiram R. Chirino
            Votes:
            4 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: