commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <BluePhe...@web.de>
Subject [collections] BeanMap and write-only properties
Date Sun, 02 Mar 2003 19:23:51 GMT
Hello.

Java Beans allows for write-only bean properties (see chapter 8.3.1 of the Java
Beans specification, 'Simple properties'). With class BeanMap it is possible to
handle write-only properties as well.

On the other hand, the #keySet method of a BeanMap instance doesn't  care about
write-only properties, because the key set is computed from the internal set of
read methods, and there is no read method for a write-only property. Moreover,
the new value parameter of the protected method #firePropertyChange will always
be null if write-only properties are involved, because the new value is computed
by the use of the read method.

The usage of write-only properties is very rare (e.g., see
http://java.sun.com/products/javabeans/docs/getListeners_p.html) and  I
recommend to introduce a comment within methods like #keySet:

"Write-only properties aren't included in the returned set of property names,
although it is possible to set their value and to get their type."

-Peter

______________________________________________________________________________
Belgien, Italien, Portugal,... Mit WEB.DE FreeMail koennen Sie in all
diese Laender SMS senden. http://freemail.web.de/features/?mc=021173


Mime
View raw message