jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] _at_FlowScoped not entirely consistent?

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Wed, 12 Aug 2015 00:26:33 +0200

Hi,

For the CDI alignment story I happened to be looking at @FlowScoped
and I wonder why it has a mandatory value attribute where a flow id
has to be put.

I could see this being useful for the purpose of creating a bean as
soon as the flow scope for the flow with that id is started (a kind of
@Eager).

But unfortunately this does not seem to be the case. As far as I can
see at least in Mojarra the value attribute of @FlowScoped is only
used to check if that bean is referenced from the correct flow.

It's not entirely clear to me why this check is needed. Wouldn't it be
more symmetrical with the other scopes as well with the EL implicit
variable #{flowScope} if it just referred to the current active flow?

E.g. @ViewScoped also refers to whatever view is the current one, and
doesn't require a mandatory check that a given @ViewScoped annotated
bean is only used with say view /myview.xhtml.

Likewise, #{flowScope} always refers to the current flow, not a
specific named one.

Now if we look at the following pairs:

@RequestScoped/#{requestScope},
@ViewScoped/#{viewScope},
@SessionScope/#{sessionScope}
@ApplicationScoped/#{applicationScope}

Then these all match pretty well, both the annotation and the EL
implicit variable refer to their current respective artefacts.

But in the case of

@FlowScoped/#{flowScope}

The annotation is restricted to a specific flow, while the EL implicit
variable refers to the current flow.

Am I missing something here, or is this indeed not entirely consistent?

Kind regards,
Arjan Tijms