Results 1 to 2 of 2

Thread: Binding to map properties

  1. #1
    Join Date
    Nov 2004
    Posts
    3

    Default Binding to map properties

    I was reading this thread:
    http://forum.springframework.com/vie...d6072 806aaeb

    and almost posted an answer I thought would work, but I tried it out, and was surprised it didn't.

    I figured you could bind map properties just like normal properties using the map propertyname spec: "attributes[key]". Doesn't work. I want to do:


    Code:
    public class Foo {
         private Map m_attributes = new HashMap();
       
         public Foo() {
                       m_attributes.put("myprop", "myvalue");
         }
    }
    
    ...
    SwingFormModel swingFormModel = SwingFormModel.createFormModel(new Foo(), true);
    ...
    swingFormModel.createBoundControl("attributes[myprop]");
    I should get a control that edits a string. I was suprised it didn't work, because this works:
    Code:
                BeanWrapperImpl beanWrapper = new BeanWrapperImpl();
                beanWrapper.setWrappedInstance(new Foo());
                beanWrapper.setPropertyValue("attributes[foo]", new String("hello"));
    The problem lies in the BeanPropertyAccessStrategy
    1) Not using the BeanWrapper to correctly get the type
    2) SwingFormModel (and others) not consistently asking just the BeanPropertyAccessStrategy for the type of a propertyName (sometimes it uses some ClassUtils stuff).

    I've got a patch in progress, but I was wondering how to submit, because the changes are both in spring sandbox and springrc.

    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Submit them to JIRA - when you do please be sure to clearly document the feature and what the expected behaivior should be.

    Thanks!
    Keith
    Keith Donald
    Core Spring Development Team

Similar Threads

  1. FlowExecutionStorage in a DB
    By cacho in forum Web Flow
    Replies: 7
    Last Post: Oct 19th, 2009, 03:36 PM
  2. Binding composite properties with DataBinder
    By dhewitt in forum Architecture
    Replies: 16
    Last Post: Jun 1st, 2007, 06:22 AM
  3. Replies: 2
    Last Post: May 9th, 2005, 06:25 PM
  4. Replies: 2
    Last Post: Jan 18th, 2005, 04:06 AM
  5. Replies: 2
    Last Post: Aug 17th, 2004, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •