• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Valid JavaBean name

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which java bean names are valid?

addListener
addMouseListener
removeListener
deleteMouseListener
registerMouseListener

Please reply..
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
None of them look like suitable names for a Java Bean to me. For one thing a Java Bean's name should follow the original Sun guidelines and start with an uppercase character.
 
Ranch Hand
Posts: 60
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham
" For one thing a Java Bean's name should follow the original Sun guidelines and start with an uppercase character. "



I think not every name is a valid Java Bean method name as long as the parameters of the methods matches with the method's names.

Eg :- If addMouseListener() will take a parameter , it can only be a MouseListener reference i.e addMouseListener(MouseListener m){ }

However , to delete a Listener , "remove" and to register a Listener ,"add" must be preceded with the function name.

So i think deleteMouseListener and registerMouseListener are not valid .
 
Mansi Agarwal
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what about " addListener" is it valid?

Acc. to me it is not.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mansi,

Are you asking us the naming convention for the methods which registers or removes the listener OR the valid names for the Javabean. The examples you have cited here sound like the ones which are suppose to register or remove the listeners

In case, your query has some thing to do with K&B book, the Javabean standard section @page 9 discuss ONLY the naming convention for the methods that are used to add or remove listeners from an event and not the valid name for the JavaBean.

Like Paul has said, none of the names you had listed are valid Javabean names. Javabean naming standard is similar to the way you name a class.


Refer 11.4 section of Javabean spec for more info.

Hope this helps!

 
ayush raj
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mansi Agarwal:
"what about " addListener" is it valid? "



Even I am of the opinion that addListener as well as removeListener should not be a valid JavaBean name . So , addMouseListener is the only valid name according to me in the entire list of names as provided
by you. But still , if anybody is sure about it , please do reply and let us know the accurate answer .


 
Mansi Agarwal
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all for clearing my doubt..
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic