本文整理汇总了Java中javax.el.ExpressionFactory.createMethodExpression方法的典型用法代码示例。如果您正苦于以下问题:Java ExpressionFactory.createMethodExpression方法的具体用法?Java ExpressionFactory.createMethodExpression怎么用?Java ExpressionFactory.createMethodExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.el.ExpressionFactory
的用法示例。
在下文中一共展示了ExpressionFactory.createMethodExpression方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionListener
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public void actionListener(ActionEvent event)
{
String value = _actionListener;
if (value != null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ELContext context = facesContext.getELContext();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(context, value, Void.TYPE,
new Class<?>[]
{ ActionEvent.class });
methodExpression.invoke(context, new Object[]
{ event });
}
}
示例2: doAction
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public String doAction()
{
String value = _action;
if (value != null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ELContext context = facesContext.getELContext();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(context, value,
String.class, new Class<?>[]
{});
value = (String) methodExpression.invoke(context, null);
}
// Post me as the selected Node for the request
postSelectedNode(this);
return value;
}
示例3: doAction
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
/**
* Gets the value of the node's action property. The action attr value
* could be one of 2 things:
* 1) An EL expression
* 2) An outcome referencing a navigation rule in the faces_config file.
*
* Since this method is called only when an ItemNode is clicked, the model
* is notified that this node is the currently selected node.
*
* @return String value of the ItemNode's "action" property.
*/
@Override
public String doAction()
{
String value = _action;
if (value != null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ELContext context = facesContext.getELContext();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(context, value,
String.class, new Class<?>[]
{});
value = (String) methodExpression.invoke(context, null);
}
// Post me as the selected Node for the request
postSelectedNode(this);
return value;
}
示例4: actionListener
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public void actionListener(ActionEvent event)
{
String value = _actionListener;
if (value != null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ELContext context = facesContext.getELContext();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(context, value, Void.TYPE,
new Class<?>[]
{ ActionEvent.class });
methodExpression.invoke(context, new Object[]{ event });
}
}
示例5: getMethodExpression
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public static MethodExpression getMethodExpression(
String expression,
PageContext pageContext,
FunctionMapper functionMap,
Class expectedType,
Class[] paramTypes) {
ELContextImpl elctxt = (ELContextImpl)pageContext.getELContext();
elctxt.setFunctionMapper(functionMap);
ExpressionFactory expFactory = getExpressionFactory(pageContext);
return expFactory.createMethodExpression(
elctxt,
expression,
expectedType,
paramTypes);
}
示例6: makeMethodExpression
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public MethodExpression makeMethodExpression(final String expression,
final Class<?> expectedReturnType,
final Class<?> ... expectedParamTypes) {
MethodExpression methodExpression = null;
try {
FacesContext fc = getContext();
ExpressionFactory factory = getExpressionFactory();
methodExpression = factory.createMethodExpression(
fc.getELContext(), expression, expectedReturnType,
expectedParamTypes);
return methodExpression;
} catch (Exception e) {
throw new FacesException("Method expression '" + expression
+ "' no se puede crear.", e);
}
}
示例7: createMethodExpression
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
/**
* Retorna una EL expression correspondiente a un metodo.
*
* @param valueExpression
* cadena que representa la expresion.
* @param expectedReturnType
* clase del tipo que se espera que retorna la expresion
* @param expectedParamTypes
* clase de los parametros esperados que reciba el metodo
*
* @return {@link MethodExpression} correspondiente
*/
public MethodExpression createMethodExpression(
final String valueExpression, final Class<?> expectedReturnType,
final Class<?> ... expectedParamTypes) {
MethodExpression methodExpression = null;
try {
FacesContext fc = getContext();
ExpressionFactory factory = fc.getApplication()
.getExpressionFactory();
methodExpression = factory.createMethodExpression(
fc.getELContext(), valueExpression, expectedReturnType,
expectedParamTypes);
} catch (Exception e) {
throw new FacesException("Method expression '" + valueExpression
+ "' could not be created.", e);
}
return methodExpression;
}
示例8: createMethodExpression
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public static MethodExpression createMethodExpression(String el,
Class returnType, Class[] paramTypes) {
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory factory = ExpressionFactory.newInstance();
return factory.createMethodExpression(
context.getELContext(),
el, null, new Class[]{String.class});
}
示例9: createMethodExpression
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
/**
* Utility method to create a JSF Method expression
*
* @param p_expression
* @param returnType
* @param parameterTypes
* @return
*/
public static MethodExpression createMethodExpression(String p_expression, Class<?> returnType,
Class<?>... parameterTypes) {
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
ELContext elContext = context.getELContext();
MethodExpression mex = expressionFactory.createMethodExpression(elContext, p_expression, returnType,
parameterTypes);
return mex;
}
示例10: unsafeELMethod
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public void unsafeELMethod(ELContext elContext,ExpressionFactory expressionFactory, String expression) {
expressionFactory.createMethodExpression(elContext, expression, String.class, new Class[]{Integer.class});
}
示例11: safeELMethod
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
public void safeELMethod(ELContext elContext,ExpressionFactory expressionFactory) {
expressionFactory.createMethodExpression(elContext, "1+1", String.class,new Class[] {Integer.class});
}
示例12: evalAsMethodExpression
import javax.el.ExpressionFactory; //导入方法依赖的package包/类
/**
* Evaluates an EL expression into an object.
*
* @param p_expression
* the expression
* @throws PropertyNotFoundException
* if the attribute doesn't exist at all (as opposed to being
* null)
* @return the object
*/
public static MethodExpression evalAsMethodExpression(String p_expression) throws PropertyNotFoundException {
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
ELContext elContext = context.getELContext();
MethodExpression mex = expressionFactory.createMethodExpression(elContext, p_expression, Object.class, new Class[0]);
return mex;
}