I have the following object hierarchie representing a tree structure:
Code:
interface Item() {
String getName();
void setName(String name);
}
interface ParentItem extends Item {
Child[] getChildren();
void setChildren(Child[]);
}
interface Child extends Item {
Parent getParent();
void setParent(Parent parent);
}
class Root implements Parent {
// implementation
}
class Node implements Parent, Child {
// implementation
}
class Leaf implements Child {
// implementation
}
I think this is a common problem, but I could not find a hint how to map this structure. Is there a best practice document how to map such a structure (multiple inheritance)?
Thanks,
Harald