Implementing association classes in Java

Hi. I'm having trouble in implementing an association class.

I have two classes, Customer and Address.

A customer might have different billing address and shipping address.

I found from a book that In this kind of situations, Customer class and Address class should be linked with an association class "Type" that has the attribute "addresstype". My problem is that I dont know how to inplement this kind of association classes in Java. Could anyone please show me some example of implementing an association class.

thanks.

[555 byte] By [rdx56a] at [2007-10-2 11:03:05]
# 1

Here is one possibility:

class Customer {

private AddressList addresses;

}

class AddressList {

private Address parent;

private List<Address> addresses;

}

class Address {

}

- Saish

Saisha at 2007-7-13 3:35:31 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Sorry, AddressList was wrong:

class AddressList {

private Customer parent; // not Address, Customer is parent

private List<Address> addresses;

}

- Saish

Saisha at 2007-7-13 3:35:31 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Please don't crosspost. http://forum.java.sun.com/thread.jspa?threadID=703778
jverda at 2007-7-13 3:35:31 > top of Java-index,Other Topics,Patterns & OO Design...