PicoContainer
  1. PicoContainer
  2. PICO-233

Have BeanPropertyComponentAdapter handle real objects and not just strings

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      3

      Description

      I've attached a patch to BeanPropertyComponentAdapter to allow it to handle real objects for parameters (such as Date objects, Calendars, etc).

      3 Test Cases attached as well. The main one (for explanation's sake is

      public void testSetBeanPropertiesWithValueObjects()

      { BeanPropertyComponentAdapterFactory factory = (BeanPropertyComponentAdapterFactory) createComponentAdapterFactory(); Map properties = new HashMap(); properties.put("lenient", Boolean.FALSE); properties.put("2DigitYearStart", new Date(0)); BeanPropertyComponentAdapter adapter = (BeanPropertyComponentAdapter)factory.createComponentAdapter(SimpleDateFormat.class,SimpleDateFormat.class,null); adapter.setProperties(properties); picoContainer.registerComponent(adapter); SimpleDateFormat dateFormat = (SimpleDateFormat)picoContainer.getComponentInstance(SimpleDateFormat.class); assertNotNull(dateFormat); assertEquals(false, dateFormat.isLenient()); assertEquals(new Date(0), dateFormat.get2DigitYearStart()); }

        Issue Links

          Activity

          Hide
          peter royal added a comment -

          Updated patch for current state of the trunk

          Show
          peter royal added a comment - Updated patch for current state of the trunk
          peter royal made changes -
          Field Original Value New Value
          Attachment BeanPropertyComponentAdapter.diff [ 16386 ]
          Hide
          Mauro Talevi added a comment -

          Pete - patched code fails to compile. Could you try updating to latest revision and recreating?
          Thanks

          Show
          Mauro Talevi added a comment - Pete - patched code fails to compile. Could you try updating to latest revision and recreating? Thanks
          Hide
          peter royal added a comment -

          updated patch. very odd it didn't apply for you.. its just an 'svn diff' against the trunk.

          Show
          peter royal added a comment - updated patch. very odd it didn't apply for you.. its just an 'svn diff' against the trunk.
          peter royal made changes -
          Attachment BeanPropertyComponentAdapter.diff [ 16399 ]
          peter royal made changes -
          Assignee peter royal [ proyal ]
          Hide
          peter royal added a comment -

          patch applied, please cross-check. thanks!

          Show
          peter royal added a comment - patch applied, please cross-check. thanks!
          peter royal made changes -
          Resolution Fixed [ 1 ]
          Fix Version/s 1.2 [ 11330 ]
          Status Open [ 1 ] Closed [ 6 ]
          Grégory Joseph made changes -
          Link This issue is related to PICO-267 [ PICO-267 ]

            People

            • Assignee:
              peter royal
              Reporter:
              Michael Rimov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: