Re: [picocontainer-dev] Exception as message passing in ConstantParameter
Konstantin Priblouda <kpriblouda-/[email protected]> Mon, 7 Jul 2008 07:11:16 -0700 (PDT)
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
----[ Konstantin Pribluda http://www.pribluda.de ]---------------- JTec quality components: http://www.pribluda.de/projects/ --- On Mon, 7/7/08, Paul Hammant <[email protected]> wrote: > From: Paul Hammant <[email protected]> > Subject: [picocontainer-dev] Exception as message passing in ConstantParameter > To: dev-qxt/[email protected] > Date: Monday, July 7, 2008, 4:31 PM > ConstantParameter has a method like :- > > > public boolean isResolvable(PicoContainer > container, > > ComponentAdapter<?> adapter, Type expectedType, > > > NameBinding > > expectedNameBinding, boolean useNames, Annotation > binding) { > > if (expectedType instanceof Class) { > > try { > > verify(container, adapter, > expectedType, > > expectedNameBinding, useNames, binding); > > return true; > > } catch(final PicoCompositionException e) > { > > return false; > > } > > } > > return false; > > } > > It feels a bit icky. In our larger test suite for Pico, the > catch is > called some 26 times. I could not say for sure whether its > a marginal > or a core code-path. Maybe not now, but verify(..) could > return > something more sophisticated than void. AFAIR, using exceptions to signal outcomes is considered antipattern. But it would be difficult to produce meaningful error message outside of parameters otherwise. regards, --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email