commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <epr...@ptc.com>
Subject Re: [Digester] SetPropertiesRule
Date Thu, 20 Feb 2003 14:20:18 GMT
That's what I thought.  Good to hear anyway, b/c I have quite a few 
beans that work this way. Thanks.


Erik



Baltz, Kenneth wrote:
> Sure it is.  fullName may not be a valid property, or it might be considered
> a read-only property, but Person is definitely a Bean.
> 
> K.C.
> 
> 
>>-----Original Message-----
>>From: Erik Price [mailto:eprice@ptc.com]
>>Sent: Wednesday, February 19, 2003 1:52 PM
>>To: Jakarta Commons Users List
>>Subject: Re: [Digester] SetPropertiesRule
>>
>>
>>Food for thought....
>>
>>I have a class that looks roughly like this:
>>
>>public class Person implements Serializable {
>>   String firstName;
>>   String lastName;
>>
>>   public void setFirstName(String firstName) {
>>     this.firstName = firstName;
>>   }
>>
>>   public void setLastName(String lastName) {
>>     this.lastName = lastName;
>>   }
>>
>>   public String getFullName() {
>>     return this.firstname + " " + this.lastName;
>>   }
>>}
>>
>>There is a getter method for a "fullName" property that 
>>doesn't exist. 
>>Is this a valid JavaBean?  Or a design flaw?
>>
>>
>>Erik
>>
>>
>>
>>Durham David Cntr 805CSS/SCBE wrote:
>>
>>>Still haven't received much on this.  Guess no one is interested.
>>>
>>>Some additional comments on this to attempt to get someone 
>>
>>to bite, then I will take this to a different, probably more 
>>appropriate forum.
>>
>>>It seems that given a getter/setter method you can 
>>
>>determine a property name, but not visa versa.  Seems 
>>backwards.  In other words the domain of property names does 
>>not have a one to one mapping to the domain of getter/setter 
>>names.  Concretely, if you had a property of "xOffset" there 
>>is no getter / setter name that corresponds to it(?).  Kinda 
>>limited.  I guess this would qualify as a design flaw?
>>
>>>Dave
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Craig R. McClanahan [mailto:craigmcc@apache.org]
>>>>Sent: Friday, February 14, 2003 5:28 PM
>>>>To: Jakarta Commons Users List
>>>>Subject: Re: [Digester] SetPropertiesRule
>>>>
>>>>
>>>>
>>>>
>>>>On Fri, 14 Feb 2003, Durham David Cntr 805CSS/SCBE wrote:
>>>>
>>>>
>>>>
>>>>>Date: Fri, 14 Feb 2003 15:57:28 -0600
>>>>>From: Durham David Cntr 805CSS/SCBE <David.Durham1@scott.af.mil>
>>>>>Reply-To: Jakarta Commons Users List 
>>>>
>>>><commons-user@jakarta.apache.org>
>>>>
>>>>>To: commons-user@jakarta.apache.org
>>>>>Subject: [Digester] SetPropertiesRule
>>>>>
>>>>>Having a problem with digester.setProperties(String).
>>>>>
>>>>>I have the following xml doc:
>>>>>
>>>>><root>
>>>>>   <element xOffset="squadron"/>
>>>>></root>
>>>>>
>>>>>
>>>>>The property does not get set in the bean unless the "x" in 
>>>>
>>>>xOffset is
>>>>
>>>>
>>>>>capitalized, i.e., "XOffset" which doesn't seem right.
>>>>>
>>>>>Is this a bug?
>>>>>
>>>>
>>>>No, it's not.  Welcome to the wonderful world of the 
>>>>JavaBeans rules on
>>>>converting property names to getter and setter method names.
>>>>
>>>>Normally, property names are expressed in "mixedCase" style, 
>>>>starting with
>>>>a lower case letter, and this would get converted into a call on a
>>>>setMixedCase() method.  For property names where the 
>>>>getter/setter method
>>>>is all upper case (i.e. getURL/setURL), there are some 
>>>>special rules; this
>>>>is also true when the first capital is in the second position 
>>>>(as it is in
>>>>your case).
>>>>
>>>>The details of the naming patterns are in the JavaBeans 
>>
>>Specification,
>>
>>>>which you can get from:
>>>>
>>>> http://java.sun.com/products/javabeans/
>>>>
>>>>Craig
>>>>
>>>>------------------------------------------------------------
>>
>>---------
>>
>>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: 
>>
>>commons-user-help@jakarta.apache.org
>>
>>>>
>>>
>>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: 
>>
>>commons-user-help@jakarta.apache.org
>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
> 
> 


Mime
View raw message