use of org.activiti.engine.impl.javax.el.ValueExpression in project Activiti by Activiti.
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;
}
use of org.activiti.engine.impl.javax.el.ValueExpression in project Activiti by Activiti.
the class AstIdentifier method setValue.
public void setValue(Bindings bindings, ELContext context, Object value) {
ValueExpression expression = bindings.getVariable(index);
if (expression != null) {
expression.setValue(context, value);
return;
}
context.setPropertyResolved(false);
context.getELResolver().setValue(context, null, name, value);
if (!context.isPropertyResolved()) {
throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
}
}
use of org.activiti.engine.impl.javax.el.ValueExpression in project Activiti by Activiti.
the class Tree method bind.
/**
* Create a bindings.
* @param fnMapper the function mapper to use
* @param varMapper the variable mapper to use
* @param converter custom type converter
* @return tree bindings
*/
public Bindings bind(FunctionMapper fnMapper, VariableMapper varMapper, TypeConverter converter) {
Method[] methods = null;
if (!functions.isEmpty()) {
if (fnMapper == null) {
throw new ELException(LocalMessages.get("error.function.nomapper"));
}
methods = new Method[functions.size()];
for (FunctionNode node : functions) {
String image = node.getName();
Method method = null;
int colon = image.indexOf(':');
if (colon < 0) {
method = fnMapper.resolveFunction("", image);
} else {
method = fnMapper.resolveFunction(image.substring(0, colon), image.substring(colon + 1));
}
if (method == null) {
throw new ELException(LocalMessages.get("error.function.notfound", image));
}
if (node.isVarArgs() && method.isVarArgs()) {
if (method.getParameterTypes().length > node.getParamCount() + 1) {
throw new ELException(LocalMessages.get("error.function.params", image));
}
} else {
if (method.getParameterTypes().length != node.getParamCount()) {
throw new ELException(LocalMessages.get("error.function.params", image));
}
}
methods[node.getIndex()] = method;
}
}
ValueExpression[] expressions = null;
if (!identifiers.isEmpty()) {
expressions = new ValueExpression[identifiers.size()];
for (IdentifierNode node : identifiers) {
ValueExpression expression = null;
if (varMapper != null) {
expression = varMapper.resolveVariable(node.getName());
}
expressions[node.getIndex()] = expression;
}
}
return new Bindings(methods, expressions, converter);
}
use of org.activiti.engine.impl.javax.el.ValueExpression in project Activiti by Activiti.
the class AstIdentifier method eval.
@Override
public Object eval(Bindings bindings, ELContext context) {
ValueExpression expression = bindings.getVariable(index);
if (expression != null) {
return expression.getValue(context);
}
context.setPropertyResolved(false);
Object result = context.getELResolver().getValue(context, null, name);
if (!context.isPropertyResolved()) {
throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
}
return result;
}
use of org.activiti.engine.impl.javax.el.ValueExpression in project Activiti by Activiti.
the class AstIdentifier method isReadOnly.
public boolean isReadOnly(Bindings bindings, ELContext context) {
ValueExpression expression = bindings.getVariable(index);
if (expression != null) {
return expression.isReadOnly(context);
}
context.setPropertyResolved(false);
boolean result = context.getELResolver().isReadOnly(context, null, name);
if (!context.isPropertyResolved()) {
throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
}
return result;
}
Aggregations