/** * Validates the expression. * * @param expressionContext * @throws ExpressionEngineException */ protected void validate(ExpressionContext expressionContext) throws ExpressionEngineException { HashMap typeMapping = (HashMap) typePairMapping.get(getClass()); if (typeMapping == null) { throw new ExpressionEngineException( "No type mapping specified for class \"" + getClass().getName() + "\""); } if (typeMapping.get(operandExpression.getReturnType()) == null) { String prefix = StringUtils.getLastToken(getClass().getName(), "."); prefix = prefix.substring(0, prefix.length() - "Expression".length()); throw new ExpressionEngineException( "Operand of type: [\"" + operandExpression.getReturnType() + "\"] is not supported by operator \"" + prefix + "\""); } }
/** @see org.ganges.expressionengine.expressions.Expression#getReturnType() */ public Type getReturnType() throws ExpressionEngineException { HashMap typeMapping = (HashMap) typePairMapping.get(getClass()); return (Type) typeMapping.get(operandExpression.getReturnType()); }
@Override protected boolean isReturnTypesNotNull() { if (right == null) return (left.getReturnType() != null); return (left.getReturnType() != null) && (right.getReturnType() != null); }