[jdom-interest] Parent & Child

phil at triloggroup.com phil at triloggroup.com
Mon Jun 2 05:17:59 PDT 2003


I liked these new interfaces because it really prevent people from using instanceof and casting object.
Why not now adding a getChildType() to Child, which returns an integer constant for each different child?
When looking at ContentList, I can see:
    public void add(int index, Object obj) {
        if (obj instanceof Element) {
            add(index, (Element) obj);
        }
        ....
A switch using a constant may perform better. Moreover, I think that the argument should be now "Child Obj" instead of
"Object obj", should'nt it?

Phil.




More information about the jdom-interest mailing list