NotYetImplementedException

I am constructing some Java library.

I designed many methods to be required in future but could only implement part of them at now.

What is the best (or better) way to make library users notice that those functions will be supported but have not been implemented yet.(I don't like to erase all unimplemented methods from the sources.)

One idea is to make my own NetYetImplementedException as a child of RuntimeException. But it is strange for me that this kind of exception does not seem to be prepared in core library, or are there?

reference to other good sample, articles about exception designing are also welcome.
akky032499Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BugLighterCommented:
I think that you might want ot use the:    
java.lang.NoSuchMethodException .        

BugLighter.
0
atifmkCommented:
Hi,
     Best way to do this is to define your own Exception class with the proper error message and throw that exception in the not implemented methods.

   In JDK APIs also there are a lot of methods not implemented and they throw the RuntimeException. There are a lot of examples, but I am able to remeber just one at present and I am giving that here:

In java.sql.PreparedStatement, if you try to set the Date parameter like this:
_________________________________________________________
PreparedStatement stat = conn.prepareStatement("SELECT * FROM Test WHERE Date=?");
stat.setDate(1, new java.sql.Date(1999, 11, 29), new GregorianCalendar());
_________________________________________________________

throws a following RuntimeException:
_________________________________________________________
java.lang.UnsupportedOperationException at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedState
ment.java:1541)
        at NotImplemented.<init>(NotImplemented.java:14)
        at NotImplemented.main(NotImplemented.java:27)
_________________________________________________________

Actually the Runtime exception is thrown in a no. of classes in JDK API, but there is not a single Exception class defined for that. Everywhere it's implementation dependent.

Hope this helps.

Regards,
Atif
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BugLighterCommented:
Working with the NoSuchMethodException
or semiliar will prevent the Use of this method while developing because the
developer will have to compose a try catch block inorder to use the unsupported method, I preffer to use it this way inorder to protected the API users, but you can either use Atif sulotion.

Regards,
BugLighter.
0
akky032499Author Commented:
Thanks atifmk, Buglighter

I knew both suggested ways but now you let me know there are no other proper way.

I may use UnsupportedOperationException for my case instead of creating my own.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.