You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Bl...@web.de on 2003/03/02 20:23:51 UTC

[collections] BeanMap and write-only properties

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


Re: [collections] BeanMap and write-only properties

Posted by Stephen Colebourne <sc...@btopenworld.com>.
I have updated the javadoc to better reflect the behaviour. Thanks
Stephen

----- Original Message -----
From: <Bl...@web.de>
To: <co...@jakarta.apache.org>
Sent: Sunday, March 02, 2003 7:23 PM
Subject: [collections] BeanMap and write-only properties


> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>