  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Design paterns for null arguments | Design paterns for null arguments 2004-05-28 - By Laxmish R. Hegde
Back I think sub class'ing the java.lang.exception and throwing that exception should work fine for you. Yes you can have a factory pattern to get the exception you would like to throw back to the client.
Cheers, Laxmish Hegde
-- --Original Message-- -- From: Sandeep Kachalia [mailto:skachalia@(protected)] Sent: Friday, May 28, 2004 2:26 PM To: J2EEPATTERNS-INTEREST@(protected) Subject: Re: Design paterns for null arguments
Thanks Ben, I wanted to open APIs for my client. The API users may pass null values as arguments. I have n number of parameters against I need to do null verification. Can we apply some pattern here through which we check the nullability and give customerized messages to user.
e.g. public void myFunction(String a,String b,String c) { Object arguments[] ; // List of argument objects; // patternApplied(Object arguments[]) throws Exception }
I hope I am able to make it clear.
Thanks, Sandeep
Ben Hill wrote:
On Fri, 2004-05-28 at 07:10, Sandeep Kachalia wrote:
Does exist a pattern for handling null arguments in a method.
any pointers??
Not a method per se. If you have some sort of idea what the null
handling should do, there may be a pattern to help.
Cheers,
Ben
====================================================================
Companion Site: http://www.corej2eepatterns.com <http://www.corej2eepatterns.com>
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns <http://java.sun.com/blueprints/corej2eepatterns>
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html <http://archives.java.sun.com/archives/j2eepatterns-interest.html>
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected) <mailto:listserv@(protected)>
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
********************************************************************* Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message, you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. *********************************************************************
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <TITLE></TITLE>
<META content="MSHTML 5.50.4937.800" name=GENERATOR></HEAD> <BODY text=#330099 bgColor=#ffffff> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=424140810-28052004>I think sub class'ing the java.lang.exception and throwing that exception should work fine <FONT face=Tahoma color=#330099>for you.</FONT></SPAN></FONT></DIV> <DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004>Yes you can have a factory pattern to get the exception you would like to throw back to the client.</SPAN></FONT></DIV> <DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT> <FONT face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT><FONT face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT> </DIV> <DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004>Cheers,</SPAN></FONT></DIV> <DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004>Laxmish Hegde</SPAN></FONT></DIV> <DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT> </DIV> <DIV><FONT face=Tahoma size=2><SPAN class=424140810-28052004></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=424140810-28052004></SPAN></FONT><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> Sandeep Kachalia [mailto:skachalia@(protected)]<BR><B>Sent:</B> Friday, May 28, 2004 2:26 PM<BR><B>To:</B> J2EEPATTERNS-INTEREST@(protected)<BR><B>Subject:</B> Re: Design paterns for null arguments<BR><BR></DIV></FONT> <BLOCKQUOTE><FONT size=-1><FONT face="Lucida Sans Unicode">Thanks Ben,<BR>I wanted to open APIs for my client. The API users may pass null values as arguments.<BR>I have n number of parameters against I need to do null verification.<BR>Can we apply some pattern here through which we check the nullability and give customerized messages to user.<BR><BR>e.g. <BR>public void myFunction(String a,String b,String c)<BR>{ Object arguments[] ; // List of argument objects; <BR> // patternApplied(Object arguments[]) throws Exception<BR>}<BR><BR>I hope I am able to make it clear.<BR><BR>Thanks,<BR>Sandeep<BR><BR></FONT></FONT><BR>Ben Hill wrote:<BR> <BLOCKQUOTE cite="mid1085735389.476.36.camel@(protected)" type="cite"><PRE wrap= "">On Fri, 2004-05-28 at 07:10, Sandeep Kachalia wrote: </PRE> <BLOCKQUOTE type="cite"><PRE wrap="">Does exist a pattern for handling null arguments in a method. any pointers?? </PRE></BLOCKQUOTE><PRE wrap=""><!----> Not a method per se. If you have some sort of idea what the null handling should do, there may be a pattern to help.
Cheers,
Ben
==================================================================== Companion Site: <A class=moz-txt-link-freetext href="http://www .corej2eepatterns.com">http://www.corej2eepatterns.com</A> J2EE BluePrints: <A class=moz-txt-link-freetext href="http://java.sun.com /blueprints/corej2eepatterns">http://java.sun.com/blueprints/corej2eepatterns</A > List Archive: <A class=moz-txt-link-freetext href="http://archives.java.sun.com /archives/j2eepatterns-interest.html">http://archives.java.sun.com/archives /j2eepatterns-interest.html</A> Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to <A class=moz-txt-link -abbreviated href="mailto:listserv@(protected)">listserv@(protected)</A> </PRE></BLOCKQUOTE>========================================================== ========== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected) </BLOCKQUOTE></BODY></HTML>
<P><FONT SIZE=2 FACE="Arial">************************************************** ******************* Disclaimer: The information in this e-mail and any attachments is confidential / privileged. It is intended solely for the addressee or addressees. If you are not the addressee indicated in this message , you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. ******************************************************** *************</FONT></P> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |