commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sharath <>
Subject Creating Map with multiple beans using apache BeanUtils.
Date Fri, 30 Oct 2009 16:59:24 GMT

Hi All,

   Say I'm having following beans

    public class Employee
         private String emp_name;
         private String emp_no;
         private Timestamp emp_doj;

         public String getEmp_name() {
	return emp_name;
         public void setEmp_name(String emp_name) {
	this.emp_name = emp_name;
         public String getEmp_no() {
	return emp_no;
         public void setEmp_no(String emp_no) {
	this.emp_no = emp_no;

         public Timestamp getEmp_doj() {
		return emp_doj;
	public void setEmp_doj(Timestamp emp_doj) {
		this.emp_doj = emp_doj;
    }//End of Employee

    Similary I have Department Bean

    public class Department
         private String dept_name;
         private String dept_no;

         //getter & setter for these properties

   say in my example program

   public class Example {

     public static void main(String args[])
             Employee emp = new Employee();

             Department dept = new Department();

             //Now I'd like to prepare Map with all employee properties and
also department properties
              Map empdeptDetails = new HashMap();

     }//End of main

   }//End of Example

   How to populate empdeptDetails map with employee and department details,
empdeptDetails  should contains properties of employee and department beans.

    empdeptDetails map will have emp_name,emp_no,emp_doj,dept_name, dept_no

    How can we can do this, whether we can create another DynaBean with
these properties, if possible how to create DynaBean?

    Please advice me.

    Thanks for your help in advance.


View this message in context:
Sent from the Commons - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message