Announcement Announcement Module
Collapse
No announcement yet.
How to use BeanUtils.copyProperties to copy values from a Map to a JavaBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use BeanUtils.copyProperties to copy values from a Map to a JavaBean

    Hi,

    I was wondering if it's possible to use BeanUtils.copyProperties to copy values from a Map based object (with map key being the property name, and map value it's value) to a JavaBean.

    I essentially need to provide a different getter method for all the properties that simply invokes .get("propertyName") on the underlying Map.

    Thanks,
    Rishabh

  • #2
    This isn't really a question about Spring!

    populate(java.lang.Object bean, java.util.Map properties)
    Populate the JavaBeans properties of the specified bean, based on the specified name/value pairs.
    http://jakarta.apache.org/commons/be...BeanUtils.html

    Comment


    • #3
      Originally posted by karldmoore View Post
      This isn't really a question about Spring!


      http://jakarta.apache.org/commons/be...BeanUtils.html
      Just 2 my cents - with this call it should be a snap to create bean-based row mapper.

      Comment


      • #4
        Thanks for your reply!

        Originally posted by karldmoore View Post
        This isn't really a question about Spring!
        I was attempting to use org.springframework.beanutils.BeanUtils, hence posted it as a Spring question. But Commons BeanUtils works just as well.

        Thanks, Rishabh

        Comment


        • #5
          Originally posted by skewed View Post
          I was attempting to use org.springframework.beanutils.BeanUtils, hence posted it as a Spring question. But Commons BeanUtils works just as well.
          Apologies, I always think of commons and not Spring. Glad you got it working.

          Comment

          Working...
          X