Announcement Announcement Module
No announcement yet.
working with bean-like objects Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • working with bean-like objects


    Assume I have an object that is not a java bean, but has the same capabilities, meaning, a way of getting / setting values by introspection. The simplest example is an object that holds all properties inside a Map instance and has get(String prop) and set(String prop, Object val) methods.

    I want to work with such objects as command objects for AbstractCommandController-s. So far, I couldn't find a reliable way.

    (Specifically, I've tried to modify AbstractCommandController, so it could bind to such objects, but it uses ServletRequestDataBinder which uses BeanWrapper from the 'errors' BindException instance, which instatiates it as BeanWrapperImpl by hard-code, and BeanWrapperImpl is very tied to java bean objects. This is all very strange type of coding from an IOC framework)

    Can someone help me with this issue please?


  • #2
    I think you have to add a custom bean introspector that you'll pass to Spring - the default one uses getXXX; you'll have to translate it into get(XXX).


    • #3
      Hello Ittay,

      i am currently thinking of doing exactly the same (dynamic properties backed by a map).

      Did you have success with this?

      Would be great if you could just give me a short notice, so that i know if it makes sense to experiment with e.g. a custom bean introspector, like costin suggested.