Hey Ed -
On 3/15/13 5:17 PM, Edward Burns wrote:
>>>>>> On Wed, 13 Mar 2013 11:44:39 -0400, Andy Schwartz <andy.schwartz_at_oracle.com> said:
>>>>>>
>
> AS> Gang -
> AS> A minor comment on the Flash API:
>
> AS> Index: javax/faces/context/Flash.java
> AS> ===================================================================
> AS> --- javax/faces/context/Flash.java (revision 8845)
> AS> +++ javax/faces/context/Flash.java (revision 11719)
>
> AS> + /** <p class="changed_added_2_2">Because <code>null</code>
> AS> + * values are not allowed as the source for subclasses of
> AS> <code>EventObject</code>,
> AS> + * such as {_at_link PostKeepFlashValueEvent} and {_at_link
> AS> PostPutFlashValueEvent},
> AS> + * this value is substituted for <code>null</code> in the case when a
> AS> + * <code>null</code> value is put to or kept in the flash.
> AS> + */
> AS> + public static final String NULL_VALUE =
> AS> "javax.faces.context.Flash.NULL_VALUE";
>
> AS> The "source" for these system events is the key, not the value.
>
> No, it really is for a null value in the flash. The point of this is
> for when you have a null value in the flash, and you still need to
> publish those related events.
>
This is such a trivial point, not sure whether it is worth pursuing,
but... the "source" of the PostKeepFlashValue/PostPutFlashValue system
events is the key (not the value) of the property that is being put/kept
in Flash scope.
The javadoc for these system events makes that clear, eg:
> /**
> * <p class="changed_added_2_2">Instantiate a new
> * <code>PostKeepFlashValueEvent</code> that indicates the argument
> * <code>key</code> was just kept in the flash. If the argument is
> * <code>null</code>, the literal {_at_link Flash#NULL_VALUE} must be
> passed
> * to the superclass constructor.</p>
>
> * @param key the key in the flash that was just kept.
> *
> */
> public PostKeepFlashValueEvent(String key) {
> super(null == key ? Flash.NULL_VALUE : key);
> }
The code which fires these events is similarly clear, eg. from
ELFlash.keep():
> if (null != toKeep) {
> getPhaseMapForWriting().put(key, toKeep);
>
> application.publishEvent(FacesContext.getCurrentInstance(),
> PostKeepFlashValueEvent.class, key);
>
> }
The one part that is confusing is the doc for NULL_VALUE, which makes it
sound as if this constant is used in cases where Flash properties have
null values, when in fact it is only used to represent null keys.
Actually, the other part that is somewhat confusing is the name. :-)
Again, it's not a big deal. I just raise it because I found this
confusing, so possible that future readers might as well.
Andy
> I have clarified it in r11751.
>
> Ed
>