1 Reply Latest reply: Apr 3, 2010 11:50 AM by 843807 RSS

    Custom/Value Objects with Java Bean

    843807
      Hey All,

      this is actaully a commons beanutil question but hoping this forum is a good spot for it.

      I have a problem with custom objects and java beans

      e.g.

      class MyCustomNumber
      {
      }

      class MyJavaBean
      {
      private MyCustomNumber someProp;
      //getter and setter
      }

      I am having alot of difficult in working with custom objects and binding them using commons bean.

      PropertyUtils doesn't seem to have type conversion, so i looked into BeanUtils

      However the problem I have, some of my properties are collections, but BeanUtils.getProperty() converts everything to a string ( very anoying )

      I need to use BeanUtils.setProperty() so I can do the type conversion, but it just doesn't seem right to

      set properties using BeanUtils.setProperty() and
      get properties using PropertyUtils.getProperty() just so I can support custom value objects and collections as bean properties.

      Can anyone give me some advice?