package org.apache.ojb.broker;
import java.util.*;
public class MainObject
{
private int id;
private String name;
private Collection subObjects;
public MainObject()
{
}
public MainObject(int id, String name)
{
setId(id);
setName(name);
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public Collection getSubObjects() {
return subObjects;
}
public void setSubObjects(Collection subObjects) {
this.subObjects = subObjects;
}
public void add(SubObject obj) {
if (subObjects == null) {
subObjects = new ArrayList();
}
subObjects.add(obj);
}
public boolean equals(Object other)
{
if (other instanceof MainObject)
{
MainObject main = (MainObject) other;
return ((name == null) ? main.name == null :
name.equals(main.name)) &&
((subObjects == null || subObjects.isEmpty()) ?
(main.subObjects
== null || main.subObjects.isEmpty())
: subObjects.equals(main.subObjects));
}
else
{
return false;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]