[seam-dev] is there an equivalent of Seam 2 @out in CDI / Seam 3

Antoine Sabot-Durand antoine at sabot-durand.net
Wed Mar 16 18:09:42 EDT 2011


Thanks for the douse I'm going to test this right away.

Antoine Sabot-Durand

Le 16 mars 2011 à 18:29, Dan Allen <dan.j.allen at gmail.com> a écrit :

You can create a producer that aliases a name to a property, like this:

@Produces @Named
public Hotel getHotel() { return booking.getHotel(); }

#{hotel}

You can also use a producer field, like so:

@Produces @Named
private Hotel hotel;

#{hotel}

Produces sort of turns outjection on it's head. But if you think about it,
it's a better way to go about it because it's more robust to read the state
of the model as it is, then try to shift the information around into
variables from which to read them, as outjection did.

What you can't do is use the same variable name to refer to state on two
different models, unless of course your producer method does some
conditional logic (saying if this screen, give this result, if this screen,
give a different result). But again, that's a good thing because then
tooling can actually tell you where the data is coming from.

This is a key topic for the migration guide. Feel free to contribute
examples of how you might solve an outjection scenario with produces. It's a
good exercise anyway.

-Dan

On Wed, Mar 16, 2011 at 13:03, Ken Finnigan <ken at kenfinnigan.me> wrote:

> If you want the result of @Produces to be EL accessible just throw a @Named
> on it.
>
> Ken
>
> Sent from my iPhone
>
> On Mar 16, 2011, at 13:02, Antoine Sabot-Durand <antoine at sabot-durand.net>
> wrote:
>
> For what I understand, it's not quite the same. I think it's more like
> @Factory, but I agree it's nearly the same and I could use it was possible
> to "Named" the "outjected" property in order to use it in EL...
>
> Antoine
>
>
>
>
>
>
>
> Le 16 mars 2011 à 17:54, Ken Finnigan a écrit :
>
> Antoine,
>
> I'm pretty sure the equivalent for CDI is to use @Produces.
>
> Ken
>
>
> On Wed, Mar 16, 2011 at 12:47 PM, Antoine Sabot-Durand <<antoine at sabot-durand.net>
> antoine at sabot-durand.net> wrote:
>
>> Hi all,
>>
>> I try to shorten my Expression language code and don't want to create
>> delegate methods in my controller to access  propertir of a business
>> component.
>>
>> I didn't found something like @Out. Does it exists ?
>>
>> Thanks,
>>
>> Antoine
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> seam-dev mailing list
>>  <seam-dev at lists.jboss.org>seam-dev at lists.jboss.org
>>  <https://lists.jboss.org/mailman/listinfo/seam-dev>
>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>
>
>
>
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev
>
>


-- 
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://www.google.com/profiles/dan.j.allen#about
http://mojavelinux.com
http://mojavelinux.com/seaminaction
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20110316/a873b579/attachment.html 


More information about the seam-dev mailing list