commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Field-Elliot <bryan_li...@netmeme.org>
Subject RE: [BeanUtils] Added Initial DynaBeans Support
Date Wed, 09 Jan 2002 21:21:23 GMT
That makes sense. I've never tried going that route before but I'll give
it a whirl with IllegalStateException.

Bryan




On Wed, 2002-01-09 at 14:24, Paulo Gaspar wrote:

    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 
      java.util.Collections.unmodifiableMap()
    
    Alternatives:
      - Create and use a RuntimeException descendent class;
      - Search the JDK Javadocs for a better one.
    
    
    Have fun,
    Paulo Gaspar
    
    http://www.krankikom.de
    http://www.ruhronline.de
     
    
    > -----Original Message-----
    > From: Bryan Field-Elliot [mailto:bryan_lists@netmeme.org]
    > 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:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
    For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
    
    
    

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message