Example usage for java.beans Expression Expression

List of usage examples for java.beans Expression Expression

Introduction

In this page you can find the example usage for java.beans Expression Expression.

Prototype

@ConstructorProperties({ "target", "methodName", "arguments" })
public Expression(Object target, String methodName, Object[] arguments) 

Source Link

Document

Creates a new Expression object for the specified target object to invoke the method specified by the name and by the array of arguments.

Usage

From source file:org.op4j.functions.Call.java

@SuppressWarnings("unchecked")
public R execute(final T input, final ExecCtx ctx) throws Exception {

    final Class<? super R> resultClass = this.resultType.getRawClass();

    final Expression expression = new Expression(input, this.methodName, this.parameters);
    final R result = (R) expression.getValue();

    if (result != null && resultClass != null && !Object.class.equals(resultClass)) {
        if (!(resultClass.isAssignableFrom(result.getClass()))) {
            throw new IllegalStateException("Result of calling method \"" + this.methodName + "\" is not "
                    + "assignable from class " + resultClass.getName());
        }/*from  w w w  .  ja  v  a2  s . co m*/
    }

    return result;

}