This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "beans" Watch "beans" New topic
Author

beans

Robert Darling
Ranch Hand

Joined: Jun 21, 2008
Posts: 100

Hi,

if i have a property in a class called _celcius will the getter and setter properties be getCelcius or get_celcius ?

Kind Regards,

Sajjad.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The variable name is irrelevant to the JavaBeans conventions; it's only the name of the methods that count. If the method is named getFoo(), then the bean property is named "foo", even if the variable the method returns is named "bob".

A method named "get_celsius()" would not count as a JavaBeans property accessor; it doesn't follow the naming convention.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: beans
 
Similar Threads
Common resource for all configurable parameters.
Dtabase Connection lost after Updating Application.
WA #1.....word association
How to read a property from a properties file in Ant?
Polymorphism of the jsp:useBean