felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: [InventoryPrinter] Finding methods by reflection
Date Mon, 11 Mar 2013 13:45:29 GMT
Hi

Why does the method need to be public ?

Ok, if you implement the interface, it is by definition public. But if you don't use the interface
?

Regards
Felix

Am 11.03.2013 um 14:26 schrieb Carsten Ziegeler:

> 2013/3/11 Felix Meschberger <fmeschbe@adobe.com>:
>> Hi,
>> 
>> Am 10.03.2013 um 19:59 schrieb Carsten Ziegeler:
>> 
>>> Hi,
>>> 
>>>> My opinion would be:
>>>> 
>>>> (a) search the implementation class only
>>>> (b) accept all method modifiers
>>>> (c) document to prefer private
>>>> 
>>>> Alternatively we could search the class hierarchy as is defined in section
112.9.4 (Locating Component Methods) of the Declarative Services specification.
>>> 
>>> I think the current implementation searches the hierarchy
>> 
>> Yes and no ;-) The current implementation walks the hierarchy but it uses the Class.getMethod
method to find the method, which actually only returns public methods. So walking the hierarchy
is essentially useless.
>> 
> Ah, right - yes the idea was that the method has to be public,
> otherwise the service is not used, now I remember :)
> 
> Carsten
> 
>> Just using getDeclaredMethod is not fully correct, because you probably don't want
to use a private method from a super class or a package private method from a super class
in a different package. Which is why I also refer to the DS specification, which explains
how to actually find and select methods from superclasses.
>> 
>> 
>>> - I don't
>>> have a strong preference, but I think searching the hierarchy is
>>> better.
>> 
>> I somehow have the impression that subclassing is not a concern for InventoryPrinter
services and in fact may not even make sense. Which is probably also why Web Console 4 does
not walk the class hierarchy for finding ConfigurationPrinter methods.
>> 
>> Regards
>> Felix
>> 
>>>> 
>>>> --
>>>> Felix Meschberger | Principal Scientist | Adobe
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Carsten Ziegeler
>>> cziegeler@apache.org
>> 
>> 
>> --
>> Felix Meschberger | Principal Scientist | Adobe
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org


--
Felix Meschberger | Principal Scientist | Adobe








Mime
View raw message