aspose file tools*
The moose likes Beginning Java and the fly likes Is it dvisable to throw exceptions inside the setter mehods ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is it dvisable to throw exceptions inside the setter mehods ?" Watch "Is it dvisable to throw exceptions inside the setter mehods ?" New topic
Author

Is it dvisable to throw exceptions inside the setter mehods ?

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Is it dvisable to throw exceptions inside the setter mehods ?

For example :



Thanks in advance.


Save India From Corruption - Anna Hazare.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Yes. Good idea.

But you should be circumspect about what sort of Exception you are throwing. I would enhance what you have written toNote that much of what I wrote is actually documentation comments, so users of that method know about the Exception.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it dvisable to throw exceptions inside the setter mehods ?