commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Gaspar" <>
Subject RE: [BeanUtils] Added Initial DynaBeans Support
Date Wed, 09 Jan 2002 21:24:30 GMT
I went trough that. That is what RuntimeExceptions are for.

First I made all methods throw some "DynaBeanException" and the whole
thing was unusable. Every time I used a DynaBean there was an exception
handling mess, and I was using them everywhere.

The way to go is using a RuntimeException descendent, either a 
standard one or a "custom made" one. That's what they are for.

For your case you can use a:
  IllegalStateException - if the bean is Read-Only at the moment;
  UnsupportedOperationException - if the bean IS a Read-Only bean.

This last one is just how the unmodifiable maps work. Take a look at
the Javadocs for 

  - Create and use a RuntimeException descendent class;
  - Search the JDK Javadocs for a better one.

Have fun,
Paulo Gaspar

> -----Original Message-----
> From: Bryan Field-Elliot []
> Sent: Wednesday, January 09, 2002 10:02 PM
> To: Jakarta Commons Developers List
> Subject: Re: [BeanUtils] Added Initial DynaBeans Support
> On Wed, 2002-01-09 at 13:02, Craig R. McClanahan wrote: 
>     Although I've added some simple unit test cases (based on the
>     existing
>     ones for standard JavaBeans), it would be really useful if some more
>     folks
>     tried out DynaBeans in the real world, and provided some feedback
>     before
>     we lock down the APIs for them.
> The DynaBean set() methods do not throw any exceptions. This makes it
> hard (in fact, impossible) for me to layer any exception semantics on
> top of the base implementation. For example, in my own implementation
> (which "extends BasicDynaBean", but could just as easily be a class
> which "implements DynaBean"), I can't enforce a read-only semantic by
> way of throwing an exception. Right now, I'm just returning without any
> action taken. Kind of silly. 
> Thanks, 
> Bryan 

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message