EL: accessing non-getter/setter

T

Timo Nentwig

Hi!

What about "read-only" properties of a bean such as size/length? In this
case I used to name the method size() rather than getSize() for a matter
of there's no setSize().

It seems that I can only access getter/setter using the EL dot syntax.
And what about hasXXX() or isXXX()?

Timo
 
T

Tim Slattery

Timo Nentwig said:
Hi!

What about "read-only" properties of a bean such as size/length? In this
case I used to name the method size() rather than getSize() for a matter
of there's no setSize().

It seems that I can only access getter/setter using the EL dot syntax.
And what about hasXXX() or isXXX()?

You can name the getter for a boolean property isXxx(). I've never
encountered anything named hasXxx().
 
R

Roedy Green

What about "read-only" properties of a bean such as size/length? In this
case I used to name the method size() rather than getSize() for a matter
of there's no setSize().
Does not matter. Beans must use the get prefix on methods they want
to export to a beanbox.
 
M

Murray

Timo Nentwig said:
I tried isEmpty() but this didn't work...


Iterator.hasNext()

I've tried that in the past also. I believe it's because 'empty' is a
reserved word.
 
M

Murray

Murray said:
I've tried that in the past also. I believe it's because 'empty' is a
reserved word.

I've also found that isXXX() methods will only work for primitive booleans
and not Booleans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top