Thanks for the response.
That doesn't do it though. If I have a class thus:
Code:
public class Element {
Set<Element> children;
Element parent;
Set<Foo> foos;
}
and I want to find an instance of Foo foo, I could do something like:
Code:
public Foo findFoo(String fooName) {
Foo foo = null;
foreach(Foo testFoo : foos){
if (testFoo.name == fooName) {
foo = testFoo;
break;
}
}
if(foo == null && parent != null){
foo = parent.findFoo(fooName);
}
return foo;
}
But if I had instead:
Code:
public class Element {
@RelatedTo(type = "CHILDREN", direction=Direction.BOTH)
Set<Element> children;
Set<Foo> foos;
}
it doesn't work the same way.
So rewording my question, is the first way I show here the better way of implemnting it?