clement escoffier wrote:
> 
> Hi,
> 
> On 27.09.2011, at 12:06, Sadish M wrote:
> 
>> 
>> hi ,
>> 
>> I  have created an handler to intercept all the public methods of a POJO
>> component using auto handler property.  By this way i am able to get all
>> the
>> method names via PojoMetadata properties as below. 
>> 
>> PojoMetadata pojoMeta = getPojoMetadata();
>> MethodMetadata[] methodMetadata = pojoMeta.getMethods();
>> String mName = methodMetadata[i].getMethodName()
>> 
>> In the methodMetadata[] array, I am able to  get the "$init()" method
>> also
>> able to register with the handler interceptors.  Everything works fine
>> until
>> then. 
>> 
>> Problem comes, when the handler intercepts the "$init()" method, via
>> "public
>> void onEntry(Object pojo, Method method, Object[] args) "  , the second
>> argument, "Method method" is not able to retrieve the name of the method
>> when I try to print the method name being intercepted; like this;
>> 
>> String xx =  method.getName();
>> This throws an null pointer exception for "$init" method alone.  For the
>> rest of all the methods, this works fine properly.
>> 
>> 
>> Please clarify me, why I could not get the name of "$init" method ? in
>> the
>> intercepted method calls to OnEntry or OnExit or OnFinish.    This causes
>> the iPojo could not instantiate and failing in constructor invocation.
> 
> Unfortunately, in the reflection API of Java,  Constructor and Method are
> two different types. So, for constructors, iPOJO can't find the Method
> object, so returns null.  I was thinking changing to Member (a parent
> class of both Method and Constructor) in the near future to avoid this
> issue. Would it help you ? Right now you can safely consider that when
> null is given as argument you're on a constructor.
> 
> Regards,
> 
> Clement
>> 
>> I request you to correct me if I have done any mistakes.
>> 
>> Thanks,
>> Sadish
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/Unable-to-retrieve-%22%24init%22--method-using-handlers-via-interceptor-method-calls-OnEntry..etc-tp32523290p32523290.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 


Hi clement,

Thanks for your message.  If there is a parent class of both method and
constructor, definitely it would help us in our developments. We are
interested in that. ! :-)
have a nice weekend !

thanks in advance,
Sadish

-- 
View this message in context: 
http://old.nabble.com/Unable-to-retrieve-%22%24init%22--method-using-handlers-via-interceptor-method-calls-OnEntry..etc-tp32523290p32569276.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to