[jdom-interest] Parameter ordering in canContain

Jason Hunter jhunter at xquery.com
Wed Feb 18 20:11:54 PST 2004


Bradley S. Huffman wrote:

> Is there some reason the order of parameters in canContain is different
> from every other JDOM method that takes a index?  

Nope.  That's just how it came in.  Good catch.

> And no other JDOM
> method declares that it throws a RuntimeException so canContain shouldn't.

Actually, we have lots of methods that explicitly declare runtime 
exceptions, like IllegalAddException.

> And what is the purpose of this method anyway, other than to save a instanceof
> on content addition, which could have been accomplished by setting a boolean
> "isElement" on ContentList construction? If it for notification of events, I'd
> prefer XOM's methodology of checkAddChild/checkRemoveChild, checkAddAttribute/
> checkRemoveChild, and so on.  Which don't contain any well-formness test, so
> you cann't screw anything up by overriding them.

I can't think of a useful purpose.  I'll pull the logic out of Document 
and Element and put it directly into private methods on ContentList.  No 
reason to have useless public methods.  I won't deprecate it since we're 
heading toward 1.0 and this method was new in beta10 anyway and probably 
has zero users (being both new and useless).

Another good catch.

-jh-




More information about the jdom-interest mailing list