In JSF 2 I have declared function inspect
which takes one argument of type java.lang.reflect.Method
and based on this argument it performs some annotation inspection and returns true
or false
. The catch is I want to call this function inspect
from JSF EL to be able to modify UI according the return value but I am not able to get a reference of target method to pass it as an argument of the function, so I would like to ask how to do it?
Example
package some.pkg;
@ManagedBean( name = "someClass" )
public class SomeClass {
@MyAnnotation
public void someMethod( String arg1, Integer arg2 ) { /* ... */ }
}
JSF function declaration
<function>
<function-name>inspect</function-name>
<function-class>some.pkg.Inspector</function-class>
<function-signature>boolean inspect(java.lang.reflect.Method)</function-signature>
</function>
Desired invocation from JSF, but it doesn't work
<h:outputText
value="someMethod is annotated by @MyAnnotation"
rendered="#{inspect(someClass.someMethod)}"
/>
Acceptable would be also this, but it is less comfortable variant
<h:outputText
value="someMethod is annotated by @MyAnnotation"
rendered="#{inspect(some.pkg.SomeClass.someMethod)}"
/>