Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-428

Provide a BeanIntrospector implementation which supports properties in a fluent API

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.8.3
    • None
    • Bean / Property Utils
    • None

    Description

      BEANUTILS-425 was about adding a mechanism for customizing bean introspection. This ticket is a request for a concrete new BeanIntrospector implementation which detects writable bean properties even if the return value of the set method is not void.

      The builder pattern and fluent API definitions become more and more popular. Here methods are offered for setting properties that return the current instance of a builder object for method chaining, for instance:

      public class FooBuilder {
          public FooBuilder setFooProperty1(String value) {
              ...
              return this;
          }
      
          public FooBuilder setFooProperty2(int value) {
              ...
              return this;
          }
      }
      

      Standard bean introspection will not recognize set methods like that because they do not conform to the Java Beans specification. A new BeanIntrospector implementation can be created which ignores the return type of set methods and create corresponding PropertyDescriptor objects with a correct write method.

      Attachments

        1. beanutils-428.patch
          14 kB
          Oliver Heger

        Issue Links

          Activity

            People

              oheger Oliver Heger
              oheger Oliver Heger
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: