On Wed, 2003-03-12 at 18:23, John Keyes wrote:
> This is I suppose something covered by a best practice, so I would like
> to hear what people think.
>
> If I have an instance that implements an interface, but does not need
> to implement all of the methods, is it better to return a value or
> throw an exception.
Well, I'm not a Commons committer or anything, but in my code when such
a situation arises, I'd probably throw a
java.lang.UnsupportedOperationException (c.f.
java.util.Collection.add()). However, as you said, usually the
situation is indicative of a bad design: there's a method in the
interface that shouldn't be.
- Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]