This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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: 24189
    
  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]
 
Have you checked out Aspose?
 
subject: beans
 
It's not a secret anymore!