File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What should be the behavior of a good wrapper library?

 
Ragunath Jawahar
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing a Java wrapper library for a REST based web service. My question is, should the library reflect its behavior EXACTLY like the web service?

Sample prototype of the web service api call translated to java - getMessages(int startIndex, int numberOfMessages);

For instance, the web service will return an error response if the numberOfMessages parameter is more than 15.

Now,
1. Should I throw an exception from the library if the numberOfMessages parameter is greater than 15.

Or

2. Can I set the numberOfMessages parameter to 15 (the maximum value allowed) and make the api call.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are adding a client-side layer between client program and web service, you can design it so that a web service call is never made with "incorrect" arguments. You shouldn't change the value in the wrapper layer, but return an error message to the client program.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic