[jsr-314-open] MethodRule API

Cay Horstmann cay at horstmann.com
Fri Jan 29 12:32:32 EST 2010


The MetaRuleset mechanism is another one of those aspects of JSF that 
just reeks of excessive complexity, combined with a half-assed API and 
useless docs. It took me a day of reading through a tangled web of 
source until I figured out how to implement my own MethodRule since the 
standard provided none.

Instead of providing a standard MethodRule class, why not just add a method

void addMethodRule(String attributeName, Class<?> returnType,
    Class<?>... paramTypes);

to ComponentHandler?

Then I can do this:

public class SpinnerHandler extends ComponentHandler {
    public SpinnerHandler(ComponentConfig config) {
       super(config);
       addMethodRule("atMax", Void.class, ActionEvent.class);
       addMethodRule("atMin", Void.class, ActionEvent.class);
    }
}

Or even better, provide a way of declaring this in the taglib.xml file 
without any coding. Then I wouldn't need a handler at all.

Cheers,

Cay

On 01/29/2010 02:42 AM, Matthias Wessendorf wrote:
> For Trinidad we added it to our API:
>
> http://svn.apache.org/viewvc?view=revision&revision=897901
>
> Yep, kinda odd to duplicate code ...
>
> On Fri, Jan 29, 2010 at 11:38 AM, Cagatay Civici
> <cagatay.civici at gmail.com>  wrote:
>> Hi,
>>
>> When testing Apache MyFaces 2 with PrimeFaces2, I've realized that Facelets
>> method rule api is implementation specific,
>>
>> so with mojarra it is com.sun.faces.facelets.tag.MethodRule
>> and with myfaces it is org.apache.myfaces.facelets.tag.MethodRule
>>
>> Is there any specific reason why it hasn't been moved to standard API eg
>> javax.faces.facelets.tag.MethodRule?
>>
>> --
>> Cagatay Civici
>> JSF EG | PrimeFaces Lead | Apache MyFaces PMC
>> http://www.primefaces.org
>>
>
>
>


-- 

Cay S. Horstmann | http://horstmann.com | mailto:cay at horstmann.com




More information about the jsr-314-open-mirror mailing list