• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JavaBean standard question from Sierra's book

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Self Test of Chapter 1 in Sierra's book there is a question:

Which method names follow the JavaBeans standard?
A. addSize
B. getCust
C. deleteRep
D. isColorado
E. putDimensions

In Self Test Answers there is an info that B and D are correct but A, C and E are incorrect, because 'add', 'delete' and 'put' are not standard JavaBeans name prefixes.

The point is that in Chapter 1 [page 10 and 11] it is written that there are valid JavaBeans names with 'add' prefix.


My question is: are these answers and explanations to the question quoted above correct?
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Javabeans prefix for methods are only get/set for getter and setters.
If a property is a boolean a getter can be is:
Example
 
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The add, remove JavaBean prefixes are intended for adding and removing Listeners, thus must be appended by Listener name.
 
Ranch Hand
Posts: 46
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add and remove are valid java bean prefixes while using with listeners only.
The explanation for the self test answer is wrong.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic