struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject RE: cvs commit: jakarta-struts/src/share/org/apache/struts/util L abelValueBean.java
Date Wed, 02 Jul 2003 04:52:02 GMT
--- Martin Cooper <martin.cooper@tumbleweed.com> wrote:
> Erm, actually, I was referring to the new:
> 
>     private String label = null;
> 
> versus the original (and exactly equivalent, AFAIK):
> 
>     private String label;

I normally operate under the belief that not everyone knows the rules as
well as we do so things like that just make it clearer.  There's also a
certain symmetry involved when initializing some variables to a value
other than its default.

Plus, it gives me a warm fuzzy feeling to know they're set to null.  

David

> 
> --
> Martin Cooper
> 
> 
> > -----Original Message-----
> > From: David Graham [mailto:grahamdavid1980@yahoo.com]
> > Sent: Tuesday, July 01, 2003 9:34 PM
> > To: Struts Developers List
> > Subject: RE: cvs commit: 
> > jakarta-struts/src/share/org/apache/struts/util
> > L abelValueBean.java
> > 
> > 
> > --- Martin Cooper <martin.cooper@tumbleweed.com> wrote:
> > > Just curious - what's the reason for explicitly 
> > initialising members to
> > > null, given that that's what happens anyway?
> > 
> > I was just in the mode of calling one constructor from every other
> > constructor and didn't even think about it.  I could have 
> > just as easily
> > called super();.  In fact, I think I'll go change that now.
> > 
> > David
> > 
> > > 
> > > --
> > > Martin Cooper
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: dgraham@apache.org [mailto:dgraham@apache.org]
> > > > Sent: Tuesday, July 01, 2003 7:20 PM
> > > > To: jakarta-struts-cvs@apache.org
> > > > Subject: cvs commit: 
> > jakarta-struts/src/share/org/apache/struts/util
> > > > LabelValueBean.java
> > > > 
> > > > 
> > > > dgraham     2003/07/01 19:20:28
> > > > 
> > > >   Modified:    src/share/org/apache/struts/util 
> > LabelValueBean.java
> > > >   Log:
> > > >   Added default constructor for PR# 18142.
> > > >   
> > > >   Revision  Changes    Path
> > > >   1.3       +14 -11    
> > > > 
> > jakarta-struts/src/share/org/apache/struts/util/LabelValueBean.java
> > > >   
> > > >   Index: LabelValueBean.java
> > > >   
> > ===================================================================
> > > >   RCS file: 
> > > > /home/cvs/jakarta-struts/src/share/org/apache/struts/util/Labe
> > > > lValueBean.java,v
> > > >   retrieving revision 1.2
> > > >   retrieving revision 1.3
> > > >   diff -u -r1.2 -r1.3
> > > >   --- LabelValueBean.java	12 Mar 2002 06:30:56 -0000	1.2
> > > >   +++ LabelValueBean.java	2 Jul 2003 02:20:28 -0000	1.3
> > > >   @@ -7,7 +7,7 @@
> > > >     *
> > > >     * The Apache Software License, Version 1.1
> > > >     *
> > > >   - * Copyright (c) 1999-2001 The Apache Software Foundation. 
> > > >  All rights
> > > >   + * Copyright (c) 1999-2003 The Apache Software Foundation. 
> > > >  All rights
> > > >     * reserved.
> > > >     *
> > > >     * Redistribution and use in source and binary forms, with 
> > > > or without
> > > >   @@ -59,13 +59,10 @@
> > > >     *
> > > >     */
> > > >    
> > > >   -
> > > >    package org.apache.struts.util;
> > > >    
> > > >   -
> > > >    import java.io.Serializable;
> > > >    
> > > >   -
> > > >    /**
> > > >     * A simple JavaBean to represent label-value pairs. This 
> > > > is most commonly used
> > > >     * when constructing user interface elements which have a 
> > > > label to be displayed
> > > >   @@ -76,7 +73,6 @@
> > > >     * @author  Martin F N Cooper
> > > >     * @version $Revision$ $Date$
> > > >     */
> > > >   -
> > > >    public class LabelValueBean implements Serializable {
> > > >    
> > > >    
> > > >   @@ -84,6 +80,13 @@
> > > >    
> > > >    
> > > >        /**
> > > >   +     * Default constructor.
> > > >   +     */
> > > >   +    public LabelValueBean() {
> > > >   +        this(null, null);
> > > >   +    }
> > > >   +
> > > >   +    /**
> > > >         * Construct an instance with the supplied property values.
> > > >         *
> > > >         * @param label The label to be displayed to the user.
> > > >   @@ -101,7 +104,7 @@
> > > >        /**
> > > >         * The property which supplies the option label 
> > > > visible to the end user.
> > > >         */
> > > >   -    private String label;
> > > >   +    private String label = null;
> > > >    
> > > >        public String getLabel() {
> > > >            return this.label;
> > > >   @@ -115,7 +118,7 @@
> > > >        /**
> > > >         * The property which supplies the value returned to 
> > > > the server.
> > > >         */
> > > >   -    private String value;
> > > >   +    private String value = null;
> > > >    
> > > >        public String getValue() {
> > > >            return this.value;
> > > >   
> > > >   
> > > >   
> > > > 
> > > > 
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> > struts-dev-help@jakarta.apache.org
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> > 
> > 
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message