• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

beans

 
Robert Darling
Ranch Hand
Posts: 100
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic