Anil K. Vijendran
Anil.Vijendran at Sun.COM
Tue Jun 12 17:58:30 PDT 2001
philip.nelson at omniresources.com wrote:
> > One of the things I'd like to be able to do with the pluggable factory
> > thing is to make certain creations illegal. I would like the ability
> > to be able to decide based on some contextual or other mechanism if
> > something is legal or not.
> > A simple protocol where the factory methods could throw an exception,
> > which is propagated to the caller of the parser would be great. If
> > there is no exception then creation proceeds normally.
> If I remember correctly, the original exceptions thrown when the JDOM nodes
> were created with illegal values where checked exceptions but the
> inconvienience of having to try/catch on what is primarly good values, moved
> the api to runtime exceptions instead.
Well, at the moment app programmers don't really use the factory to create the
JDOM nodes. Really it is just the SAXBuilder that uses the factory. I think it would
be good to make it part of the JDOM factory API the ability for the factory to
specifically say "heck no. this type of node is illegal in this context". Of course
unchecked exceptions can be thrown and that's what I'm doing now. But just looking
at the factory API, it kind of seems like you _have to_ return something always.
Not really a biggie.
The other issue I have with this factory thingy is the ability for the factory to
have more context while creating a node. Specifically I'd like the ability to have
the stack of nodes available to me when I create nodes. Thoughts?
> SAXBuilder will catch these exceptions so the propogation back up to the
> caller is also handled for you. Make sense?
> To control your jdom-interest membership:
Peace, Anil +<:-)
More information about the jdom-interest