[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: Re: Creating Map with multiple beans using apache BeanUtils.
From: sharath <karnatis () yahoo ! com>
Date: 2009-10-30 20:10:45
Message-ID: 26136252.post () talk ! nabble ! com
[Download RAW message or body]
sharath wrote:
>
> 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();
> emp.setEmp_name("Robert");
> emp.setEmp_no("10001-A");
> emp.setEmp_doj(java.util.getDate());
>
> Department dept = new Department();
> dept.setDept_name("Computers");
> dept.setDept_no("101");
>
> //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 values.
>
> 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.
>
> Regards,
> Sharath.
>
>
Thanks, it worked. I tried this method incorrectly.
--
View this message in context: \
http://old.nabble.com/Creating-Map-with-multiple-beans-using-apache-BeanUtils.-tp26133572p26136252.html
Sent from the Commons - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic