本文整理汇总了Java中javax.el.MethodExpression.invoke方法的典型用法代码示例。如果您正苦于以下问题:Java MethodExpression.invoke方法的具体用法?Java MethodExpression.invoke怎么用?Java MethodExpression.invoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.el.MethodExpression
的用法示例。
在下文中一共展示了MethodExpression.invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionListener
import javax.el.MethodExpression; //导入方法依赖的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: actionListener
import javax.el.MethodExpression; //导入方法依赖的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 });
}
}
示例3: doAction
import javax.el.MethodExpression; //导入方法依赖的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: broadcastToMethodExpression
import javax.el.MethodExpression; //导入方法依赖的package包/类
/**
* Broadcast an event to a MethodExpression.
* This can be used to support MethodBindings such as the "actionListener"
* binding on ActionSource components:
* <tr:commandButton actionListener="#{mybean.myActionListener}">
*/
protected final void broadcastToMethodExpression(
FacesEvent event,
MethodExpression method) throws AbortProcessingException
{
if (method != null)
{
try
{
FacesContext context = getFacesContext();
method.invoke(context.getELContext(), new Object[] { event });
}
catch (ELException ee)
{
Throwable t = ee.getCause();
// Unwrap AbortProcessingExceptions
if (t instanceof AbortProcessingException)
throw ((AbortProcessingException) t);
throw ee;
}
}
}
示例5: testBug53792b
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testBug53792b() {
MethodExpression me = factory.createMethodExpression(context,
"${beanA.setBean(beanB)}", null ,
new Class<?>[] { TesterBeanB.class });
me.invoke(context, null);
me = factory.createMethodExpression(context,
"${beanB.setName('" + BUG53792 + "')}", null ,
new Class<?>[] { TesterBeanB.class });
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context,
"#{beanA.getBean().name.length()}", java.lang.Integer.class);
Integer actual = (Integer) ve.getValue(context);
assertEquals(Integer.valueOf(BUG53792.length()), actual);
}
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:17,代码来源:TestMethodExpressionImpl.java
示例6: testInvokeWithSuperABNoReturnTypeNoParamTypes
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithSuperABNoReturnTypeNoParamTypes() {
MethodExpression me2 = factory.createMethodExpression(context,
"${beanC.sayHello(beanA,beanB)}", null , null);
Object r2 = me2.invoke(context, null);
assertEquals("AB: Hello A from B", r2.toString());
}
示例7: testBug57855d
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testBug57855d() {
MethodExpression me = factory.createMethodExpression(context,
"${beanB.echo}", null , new Class[]{String.class});
Object r = me.invoke(context, new String[] { "aaa" });
assertEquals("aaa", r.toString());
}
示例8: testBug52970
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testBug52970() {
MethodExpression me = factory.createMethodExpression(context,
"${beanEnum.submit('APPLE')}", null ,
new Class<?>[] { TesterBeanEnum.class });
me.invoke(context, null);
ValueExpression ve = factory.createValueExpression(context,
"#{beanEnum.lastSubmitted}", TesterEnum.class);
TesterEnum actual = (TesterEnum) ve.getValue(context);
assertEquals(TesterEnum.APPLE, actual);
}
示例9: testInvokeWithSuperABReturnTypeNoParamTypes
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithSuperABReturnTypeNoParamTypes() {
MethodExpression me3 = factory.createMethodExpression(context,
"${beanC.sayHello(beanA,beanB)}", String.class , null);
Object r3 = me3.invoke(context, null);
assertEquals("AB: Hello A from B", r3.toString());
}
示例10: testInvokeWithSuperABBB
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithSuperABBB() {
MethodExpression me7 = factory.createMethodExpression(context,
"${beanC.sayHello(beanA,beanBBB)}", null , null);
Object r7 = me7.invoke(context, null);
assertEquals("ABB: Hello A from BBB", r7.toString());
}
示例11: testBug56797b
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testBug56797b() {
MethodExpression me = factory.createMethodExpression(context,
"${beanAA.echo2('Hello World!')}", null , null);
Object r = me.invoke(context, null);
assertEquals("AA2Hello World!", r.toString());
}
示例12: testInvokeWithSuperAAABBB
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithSuperAAABBB() {
MethodExpression me13 = factory.createMethodExpression(context,
"${beanC.sayHello(beanAAA,beanBBB)}", null , null);
Exception e = null;
try {
me13.invoke(context, null);
} catch (Exception e1) {
e = e1;
}
// Expected to fail
assertNotNull(e);
}
示例13: testInvokeWithSuperAABB
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithSuperAABB() {
MethodExpression me9 = factory.createMethodExpression(context,
"${beanC.sayHello(beanAA,beanBB)}", null , null);
Exception e = null;
try {
me9.invoke(context, null);
} catch (Exception e1) {
e = e1;
}
// Expected to fail
assertNotNull(e);
}
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:14,代码来源:TestMethodExpressionImpl.java
示例14: testInvokeWithSuperABReturnTypeParamTypes
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithSuperABReturnTypeParamTypes() {
MethodExpression me5 = factory.createMethodExpression(context,
"${beanC.sayHello(beanA,beanB)}", String.class ,
new Class<?>[] {TesterBeanA.class, TesterBeanB.class});
Object r5 = me5.invoke(context, null);
assertEquals("AB: Hello A from B", r5.toString());
}
示例15: testInvokeWithVarArgsAAB
import javax.el.MethodExpression; //导入方法依赖的package包/类
@Test
public void testInvokeWithVarArgsAAB() throws Exception {
MethodExpression me4 = factory.createMethodExpression(context,
"${beanC.sayHello(beanAA,beanB,beanB)}", null , null);
Exception e = null;
try {
me4.invoke(context, null);
} catch (Exception e1) {
e = e1;
}
// Expected to fail
assertNotNull(e);
}