当前位置: 首页>>代码示例>>Java>>正文


Java ExpressionFactory.createMethodExpression方法代码示例

本文整理汇总了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 });
  }

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:20,代码来源:ImmutableItemNode.java

示例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;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:ImmutableItemNode.java

示例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;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:35,代码来源:ItemNode.java

示例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 });
  }

}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:ItemNode.java

示例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);
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:17,代码来源:PageContextImpl.java

示例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);
	}
}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:19,代码来源:ELHelper.java

示例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;
}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:32,代码来源:ControllerHelper.java

示例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});
}
 
开发者ID:rcandidosilva,项目名称:paas-iot-platform,代码行数:9,代码来源:JSFHelper.java

示例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;
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:19,代码来源:ELTools.java

示例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});
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:4,代码来源:ElExpressionSample.java

示例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});
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:4,代码来源:ElExpressionSample.java

示例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;
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:18,代码来源:AJAXBroadcastComponent.java


注:本文中的javax.el.ExpressionFactory.createMethodExpression方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。