O'Reilly Forums: What Design Pattern To Use In This Example? - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

What Design Pattern To Use In This Example?

#1 User is offline   Andy0303 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-April 12

Posted 10 April 2012 - 07:58 PM

I have a class as below

class Manager {

String name = "";
ArrayList events = new ArrayList();

}

events can contain different class types depends on the situation. For example, it could contain events of type ClassA or ClassB or ClassC. But only one class type at a time. It does not contain ClassA AND ClassB but either ClassA OR ClassB at a time.

What I have is an instance of Class Manager. I don't know what class type is in events field. What I want back is an XML string of the content of events.

What design pattern can I use in this case?

Thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users