Search in sources :

Example 6 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class AstIdentifier method getType.

public Class<?> getType(Bindings bindings, ELContext context) {
    ValueExpression expression = bindings.getVariable(index);
    if (expression != null) {
        return expression.getType(context);
    }
    context.setPropertyResolved(false);
    Class<?> result = context.getELResolver().getType(context, null, name);
    if (!context.isPropertyResolved()) {
        throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
    }
    return result;
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ValueExpression(org.camunda.bpm.engine.impl.javax.el.ValueExpression)

Example 7 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class AstProperty method getMethodInfo.

public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) {
    Object base = prefix.eval(bindings, context);
    if (base == null) {
        throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix));
    }
    Object property = getProperty(bindings, context);
    if (property == null && strict) {
        throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base));
    }
    String name = bindings.convert(property, String.class);
    Method method = findMethod(name, base.getClass(), returnType, paramTypes);
    return new MethodInfo(method.getName(), method.getReturnType(), paramTypes);
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) MethodInfo(org.camunda.bpm.engine.impl.javax.el.MethodInfo) Method(java.lang.reflect.Method)

Example 8 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class AstProperty method invoke.

public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) {
    Object base = prefix.eval(bindings, context);
    if (base == null) {
        throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix));
    }
    Object property = getProperty(bindings, context);
    if (property == null && strict) {
        throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base));
    }
    String name = bindings.convert(property, String.class);
    Method method = findMethod(name, base.getClass(), returnType, paramTypes);
    try {
        return method.invoke(base, paramValues);
    } catch (IllegalAccessException e) {
        throw new ELException(LocalMessages.get("error.property.method.access", name, base.getClass()));
    } catch (IllegalArgumentException e) {
        throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e);
    } catch (InvocationTargetException e) {
        throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e.getCause());
    }
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) Method(java.lang.reflect.Method) ELException(org.camunda.bpm.engine.impl.javax.el.ELException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

PropertyNotFoundException (org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException)8 ValueExpression (org.camunda.bpm.engine.impl.javax.el.ValueExpression)4 Method (java.lang.reflect.Method)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ELException (org.camunda.bpm.engine.impl.javax.el.ELException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ExpressionGetInvocation (org.camunda.bpm.engine.impl.delegate.ExpressionGetInvocation)1 ELContext (org.camunda.bpm.engine.impl.javax.el.ELContext)1 MethodInfo (org.camunda.bpm.engine.impl.javax.el.MethodInfo)1 MethodNotFoundException (org.camunda.bpm.engine.impl.javax.el.MethodNotFoundException)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1 Deployment (org.camunda.bpm.engine.test.Deployment)1