Avatar of jaggernat
jaggernat

asked on 

Avoiding Duplicate VOs

Hi guys

I have a VO called customerVO

public class CustomerVO
{
public string name;
public int age;

setName();
getName();

setAge();
getAge();


}

In my backend DAO , i am querying the database table and populating the name and age in CustomerVO

In my jsp (UI) , i am displaying information like this


New Customer
------------
Name :getName()
Age  :getAge()


Old Customer  
-------------
Name :getName()
Age  :getAge()

But the problem is New Customer Name and Age is different from Old Customer Name and Age.
so ideally i would need to have two seperate VOs, NewCustomerVO  and OldCustomerVO.

something like

public class NewCustomerVO  
{
public string name;
public int age;

setName();
getName();

setAge();
getAge();
}

public class OldCustomerVO
{
public string name;
public int age;

setName();
getName();

setAge();
getAge();
}

The contents of NewCustomerVO and OldCustomerVO are the same.

Is it possible to avoid that. I just want to reuse one VO for displaying 'New Customer' and 'old customer' information.

Any idea how that can be done?

Thanks v much
J
Java

Avatar of undefined
Last Comment
jaggernat

8/22/2022 - Mon