felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michiel Vermandel <mverm...@yahoo.com>
Subject [iPOJO] My own runtime annotations get lost (proxied)
Date Fri, 03 May 2013 07:34:57 GMT
Hi,


I do not use @Requires on that field. I use my own @Channel.
The @Channel is how ever declared in a bundle which goes through the manipulator.
Will the manipulator create a proxy for this annotation?
(I cannot user proxy=false since the annotation is custom, not @Requires)

Thanks
 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Clement Escoffier <clement.escoffier@gmail.com>
To: users@felix.apache.org; Michiel Vermandel <mvermand@yahoo.com> 
Sent: Thursday, May 2, 2013 8:07 PM
Subject: Re: [iPOJO] My own runtime annotations get lost (proxied)
 

Hi,

If you try to grab the object from a @Requires injected field, you are getting a proxy. Disable
the proxy to get a direct reference on the object.

Regards,

Clement

On 2 mai 2013, at 13:46, Michiel Vermandel <mvermand@yahoo.com> wrote:

> Hi,
> 
> I have some custom annotations with retention ==
 runtime.
> Now, when I use these annotations on an object that is also annotated as iPOJO component,
I cannot access my annotations anymore on a created instance of the component.
> If I list the annotations on such annotated field, I get something like $Proxy17 as class
instead of my custom annotation class.
> 
> This how I try to get to the annotations:
> 
> (simplified example:)
> 
> my iPOJO with custom annotation:
> 
> @Component
> @Provides
> public class DeviceService{
>    
>     @Channel(payload = DeviceBean.class, type= VOLUME_STATE_CHANGED) // <= custom
annotation
>     EventLogger volumeStateChanged;
> 
> ...
> 
> When I get hold of the component instance, I get to the original(manipulated) object
like this:
> Object instancePojo = ((InstanceManager) instance).getPojoObject();
> Then
 I get the field volumeStateChanged and try to get the @Channel annotation.
> Which fails => field.getAnnotation(Channel.class) == null
> 
> 
> Is there a way to keep/get the original annotation on my field?
> (The code should work outside iPOJO as well, So I need my custom - non iPOJO - annotations)
> 
> Thanks!
> 
>  
> -----------------
> http://www.codessentials.com - Your essential software, for free!
> Follow us at http://twitter.com/#!/Codessentials
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message