You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2005/07/01 20:54:08 UTC

[OT]java bean question

Hello
I have java bean where in there is one property as
below
private java.lang.String P813NAME ;
public void setP813NAME (java.lang.String P813NAME )
{
this.P813NAME = P813NAME;
}
public java.lang.String getP813NAME ()
{
return this.P813NAME ;
}

is this valid or not?
if not why not and where i can find specification for
java bean

Ashish

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: [OT]java bean question

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Ashish Kulkarni" <ku...@yahoo.com>
> I have java bean where in there is one property as
> below
> private java.lang.String P813NAME ;
> public void setP813NAME (java.lang.String P813NAME )
> {  this.P813NAME = P813NAME; }
> public java.lang.String getP813NAME ()
> { return this.P813NAME ; }
>
> is this valid or not?
> if not why not and where i can find specification for
> java bean

The JavaBeans Specification can be found here:
     http://java.sun.com/products/javabeans/reference/api/index.html

The spec deals with uppercase property names by looking at the first two
characters, and if they are uppercase, not decapitalizing.  Since your
second character is a number, my guess is that it will think the property
name is p813NAME, not what you want.

If you can possibly rename this property, do it... your life will be much
easier.  And if you don't get a good answer here, try commons-user and put
[beanutils] in the subject line.

-- 
Wendy Smoak


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


Re: [OT]java bean question

Posted by Leon Rosenberg <st...@anotheria.net>.
You must be scott ambler fan :-) 

Or maybe not, he suggests words like a, an, some
public void setValue(int aValue){
	value = aValue;
}

In his coding conventions...
http://www.ambysoft.com/javaCodingStandards.html

Regards
Leon

P.S. don't blame anyone for using this.x = x too fast, it's often generated
by ides, even eclipse did it in one of the versions.

> -----Ursprüngliche Nachricht-----
> Von: Frank W. Zammetti [mailto:fzlists@omnytex.com] 
> Gesendet: Freitag, 1. Juli 2005 21:19
> An: Struts Users Mailing List
> Cc: Struts Users Mailing List
> Betreff: Re: [OT]java bean question
> 
> Since this thread was marked as OT, I figured I'd contribute 
> an OT reply :)
> 
> It is worth noting that the syntax...
> 
> this.someProperty = property;
> 
> ...is usually flagged by static code analysis tools because 
> the incoming parameter shadows that of the class.  True, 
> using "this" disambiguates (is that a word?!?) the reference 
> and no harm is done.  I myself used to use that syntax all the time.
> 
> However, I've gotten into the habit of doing...
> 
> public void setSomeProperty(String inSomeProperty) {
>   someProperty = inSomeProperty;
> }
> 
> ...if for no other reason than to avoid the extra errors 
> emitted by CheckStyle and the like.
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Fri, July 1, 2005 3:21 pm, BHansard@powersystems.rockwell.com said:
> >
> >>From the javabean spec this is acceptable.  However, it is 
> not good  
> >>coding
> > standards to have a property in all upper case.  The java standard 
> > naming convention has constance as all upper case, 
> properties as camel case.
> > Struts would have a problem with this because it is looking for the 
> > first letter of the property to be lowercase.
> >
> > if this is a procedure name it would be better to have the 
> parameter 
> > as either p813name or procP813NAME.
> >
> >
> >
> >              Ashish Kulkarni
> >              <kulkarni_ash1312
> >              @yahoo.com>                                    
>             To
> >                                        user@struts.apache.org
> >              07/01/2005 02:54                               
>             cc
> >              PM
> >                                                             
>        Subject
> >                                        [OT]java bean question
> >              Please respond to
> >                "Struts Users
> >                Mailing List"
> >              <user@struts.apac
> >                   he.org>
> >
> >
> >
> >
> >
> >
> > Hello
> > I have java bean where in there is one property as below private 
> > java.lang.String P813NAME ; public void setP813NAME 
> (java.lang.String 
> > P813NAME ) { this.P813NAME = P813NAME; } public java.lang.String 
> > getP813NAME () { return this.P813NAME ; }
> >
> > is this valid or not?
> > if not why not and where i can find specification for java bean
> >
> > Ashish
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



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


Re: [OT]java bean question

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Since this thread was marked as OT, I figured I'd contribute an OT reply :)

It is worth noting that the syntax...

this.someProperty = property;

...is usually flagged by static code analysis tools because the incoming
parameter shadows that of the class.  True, using "this" disambiguates (is
that a word?!?) the reference and no harm is done.  I myself used to use
that syntax all the time.

However, I've gotten into the habit of doing...

public void setSomeProperty(String inSomeProperty) {
  someProperty = inSomeProperty;
}

...if for no other reason than to avoid the extra errors emitted by
CheckStyle and the like.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, July 1, 2005 3:21 pm, BHansard@powersystems.rockwell.com said:
>
>>>From the javabean spec this is acceptable.  However, it is not good
>> coding
> standards to have a property in all upper case.  The java standard naming
> convention has constance as all upper case, properties as camel case.
> Struts would have a problem with this because it is looking for the first
> letter of the property to be lowercase.
>
> if this is a procedure name it would be better to have the parameter as
> either p813name or procP813NAME.
>
>
>
>              Ashish Kulkarni
>              <kulkarni_ash1312
>              @yahoo.com>                                                To
>                                        user@struts.apache.org
>              07/01/2005 02:54                                           cc
>              PM
>                                                                    Subject
>                                        [OT]java bean question
>              Please respond to
>                "Struts Users
>                Mailing List"
>              <user@struts.apac
>                   he.org>
>
>
>
>
>
>
> Hello
> I have java bean where in there is one property as
> below
> private java.lang.String P813NAME ;
> public void setP813NAME (java.lang.String P813NAME )
> {
> this.P813NAME = P813NAME;
> }
> public java.lang.String getP813NAME ()
> {
> return this.P813NAME ;
> }
>
> is this valid or not?
> if not why not and where i can find specification for
> java bean
>
> Ashish
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: [OT]java bean question

Posted by BH...@powersystems.rockwell.com.
>From the javabean spec this is acceptable.  However, it is not good coding
standards to have a property in all upper case.  The java standard naming
convention has constance as all upper case, properties as camel case.
Struts would have a problem with this because it is looking for the first
letter of the property to be lowercase.

if this is a procedure name it would be better to have the parameter as
either p813name or procP813NAME.


                                                                           
             Ashish Kulkarni                                               
             <kulkarni_ash1312                                             
             @yahoo.com>                                                To 
                                       user@struts.apache.org              
             07/01/2005 02:54                                           cc 
             PM                                                            
                                                                   Subject 
                                       [OT]java bean question              
             Please respond to                                             
               "Struts Users                                               
               Mailing List"                                               
             <user@struts.apac                                             
                  he.org>                                                  
                                                                           
                                                                           




Hello
I have java bean where in there is one property as
below
private java.lang.String P813NAME ;
public void setP813NAME (java.lang.String P813NAME )
{
this.P813NAME = P813NAME;
}
public java.lang.String getP813NAME ()
{
return this.P813NAME ;
}

is this valid or not?
if not why not and where i can find specification for
java bean

Ashish

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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