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

Plugable Property Name Expression Resolver

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0
    • Expression Syntax
    • None

    Description

      There are a number of outstanding bugs against the BeanUtils expression syntax with people wanting BeanUtils to support different variations. There is also a duplication of the "expression evaluation" code in various methods which can't be tested in isolation and is difficult to maintain as changes have to be applied uniformly to various places.

      The main places where the code is duplicated:
      PropertyUtilsBean

      • getNestedProperty
      • setNestedProperty
      • getPropertyDescriptor
        BeanUtilsBean
      • copyProperty
      • setProperty

      LocaleBeanUtils has also implemented an alternative mechanism - using a Descriptor object to resolve references. BeanUtils and PropertyUtils also work in slightly different ways. There are also other methods (e.g. PropertyUtilsBean's getIndexedProperty() method) which also have related code.

      I propose to add a new "expression resolver" interface, which would be a singleton and everywhere would delegate to to resolve property expressions. This will allow easy testing as it can be tested in isolation and provide a uniform mechanism accross BeanUtils. It will also allow alternative syntax to be implemented if the resolver implementation can be configured.

      Attachments

        1. BasicResolver.java
          7 kB
          Niall Pemberton
        2. BasicResolverTestCase.java
          8 kB
          Niall Pemberton
        3. Resolver.java
          2 kB
          Niall Pemberton

        Issue Links

          Activity

            People

              niallp Niall Pemberton
              niallp Niall Pemberton
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: