aspose file tools*
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: 24184
    
  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]
 
Consider Paul's rocket mass heater.
 
subject: beans