[webbeans-dev] Re: Producer fields on EJBs

Pete Muir pmuir at redhat.com
Mon Apr 6 12:31:37 EDT 2009


Carlo, Ken, Andrew,

JSR-299 supports the notion of a producer field. By adding the  
annotation @Produces to a field, you make it into a bean, which can be  
used as the source of injections. The field can also be associated  
with a scope. When you first look up an instance of a bean, the field  
value is accessed, and stored in the context for it's lifetime.

As we deal with EJB references, we can't directly access the field  
value (using reflection) so I think we should use the SPI here.

I propose we add a method with this signature to the  
SessionObjectReference we previously created for the purpose of  
casting/removing EJBs https://svn.jboss.org/repos/webbeans/ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java

/**
     * Retrieve the value of a (possibly private) field
     *
     * @param field
     *           the field to retrieve the value of
     * @return the retrieved value
     * @throws IllegalArgumentException
     *            if the field doesn't exist on this session object  
instance
     */
    public Object getFieldValue(Field field);

Any comments?


On 29 Mar 2009, at 22:57, Pete Muir wrote:

> Ok, I would think that some language in the spec to hint at this  
> might be good, as instances of session beans elsewhere in the spec  
> implies a EJB reference.
>
> On 29 Mar 2009, at 18:04, Gavin King wrote:
>
>> Yes, this is a good question - the 299 implementation would need
>> direct integration with the EJB container for this. (Not the only
>> place this is needed.)
>>
>>
>> On Sat, Mar 28, 2009 at 7:18 PM, Pete Muir <pmuir at redhat.com> wrote:
>>> Hey
>>>
>>> Not quite sure how this is supposed to work as everywhere we hold a
>>> reference (proxy) to the EJB, and therefore don't have access to the
>>> instance and therefore can't get hold of the fields. Any pointers?
>>>
>>> Thanks!
>>>
>>>
>>> --
>>> Pete Muir
>>> http://www.seamframework.org
>>> http://in.relation.to/Bloggers/Pete
>>>
>>>
>>
>>
>>
>> -- 
>> Gavin King
>> gavin.king at gmail.com
>> http://in.relation.to/Bloggers/Gavin
>> http://hibernate.org
>> http://seamframework.org
>
> --
> Pete Muir
> http://www.seamframework.org
> http://in.relation.to/Bloggers/Pete
>
> _______________________________________________
> webbeans-dev mailing list
> webbeans-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/webbeans-dev

--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete




More information about the weld-dev mailing list