On Thu, 15 Nov 2001 22:03, Sylvain Wallez wrote:
> > We already have an ExceptionUtil in
> > org.apache.avalon.framework.ExceptionUtil. I would prefer adding a couple
> > signatures:
> >
> > /** two member version will set the first variable if not set, or throw
> > exception */ ExceptionUtil.check(this.manager, manager, "Manager already
> > set");
> >
> > /** one member version used for state checking */
> > ExceptionUtil.check(this.isInitialized, "Component not initialized");
>
> That's nice : it avoids an additional class and the associated import,
> but "check" may be to imprecise in the context of "ExceptionUtil". So
> what about something like "checkImmutable()" for the first one ? The
> second is a simple assertion, so what about an "assertTrue()" (until the
> whole world uses JDK 1.4) ?
I think I would still prefer something like
if( null != m_manager )
{
throw new IllegalStateException( "manager already set");
}
Slightly more typing but far less coupling and easier to understand IMO.
--
Cheers,
Pete
----------------------------------------
"Liberty means responsibility. That is
why most men dread it." - Locke
----------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>