dlr 02/02/24 18:06:19 Modified: lang/src/java/org/apache/commons/lang Constant.java Log: Added some more header JavaDoc to bayard's Constant class, which includes reference to a couple of relevant JavaWorld articles on this topic: http://www.javaworld.com/javaworld/javatips/jw-javatip27.html http://www.javaworld.com/javaworld/javatips/jw-javatip50.html Revision Changes Path 1.2 +24 -13 jakarta-commons-sandbox/lang/src/java/org/apache/commons/lang/Constant.java Index: Constant.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/lang/src/java/org/apache/commons/lang/Constant.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- Constant.java 23 Feb 2002 04:09:27 -0000 1.1 +++ Constant.java 25 Feb 2002 02:06:19 -0000 1.2 @@ -55,22 +55,33 @@ */ /** - * Used to signify a constant value. Most commonly expected to be used - * in an interface, passed to a method that takes type: Constant and - * tests by equality and not the .equals() method. + * <p>Used to signify a type safe constant value. Most commonly + * employed as part of an interface, <code>Constant</code> instances + * (or extensions thereof) are passed as parameters to a method whose + * implementation uses memory address comparisons (i.e. use of the + * <code>==</code> operator, rather than the <code>equals()</code> + * method).</p> * - * The constant wraps an Object value, thus allowing the Constant to - * contain actual information and not just a new Object. - * It also adds typing information, so users of your code are forced - * to use your constant and not push their own magic number in. + * <p>The constant wraps an <code>Object</code> value, thus allowing + * the <code>Constant</code> to contain actual information and not + * just a new <code>Object</code>. It also adds typing information, + * so users of your code are forced to use your constant and not push + * their own magic number in.</p> * - * It is extendable, so the cosntant can contain more than just the one - * value. It's not an interface, allowing people to provide their - * own classes which are 'Constantable' as this does not fit the - * use of ==. + * <p>It is extendable, so the cosntant can contain more than just the + * one value. It's not an interface, allowing people to provide their + * own classes which are 'Constantable' as this does not fit the use + * of the <code>==</code> operator.</p> + * + * <p>Articles describing the use of this pattern can be found in + * JavaWorld's <a + * href="http://www.javaworld.com/javaworld/javatips/jw-javatip27.html">tip + * 27</a> and + * <href="http://www.javaworld.com/javaworld/javatips/jw-javatip50.html">tip + * 25</a>.</p> * * @author <a href="mailto:[EMAIL PROTECTED]">Henri Yandell</a> - * @version $Id: Constant.java,v 1.1 2002/02/23 04:09:27 bayard Exp $ + * @version $Id: Constant.java,v 1.2 2002/02/25 02:06:19 dlr Exp $ */ public class Constant { @@ -131,7 +142,7 @@ * @return Object value being wrapped. */ public Object getValue() { - if(this.value instanceof Constant) { + if (this.value instanceof Constant) { return ((Constant)this.value).getValue(); } else { return this.value;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
