Kohsuke Kawaguchi wrote:
> Jitendra Kotamraju wrote:
>
>>> public class FooFeature extends WebServiceFeature {
>>> public static final String ID = "foo";
>>> private final boolean param2;
>>> private final String param1;
>>>
>>> public FooFeature(
>>> @FeatureParameter("param1") String param1,
>>> @FeatureParameter("param2") boolean param2){
>>> this.param1 = param1;
>>> this.param2 = param2;
>>> }
>>> }
>>>
>>> This approach minimizes the exposure of this mechanism to the users.
>>
>> How does one get param2, param1 ? are they supposed be public ?
>> Otherwise, it makes it hard to use the bean
>
>
> The problem at hand is how to populate a bean from its corresponding
> annotation. One can use reflection to get all annotation parameters,
> then use the reflection again to invoke the constructor. The only
> missing piece is to figure out which parameter corresponds to which
> annotation element, and hence this @FeatureParameter annotation.
Yes, if we don't want the @FeatureParameter annotation, then we have to
define a pattern(for an annotation element there is a corresponding
set+annotationelement setter method). Then call setter methods on the
bean but that makes the bean mutable.
Jitu
>
>