protected void evaluateNode(OOEEEvaluationContext context) throws EvaluationException { try { getValueClass(); } catch (ParsingException e) { throw new EvaluationException(ExceptionConstants.EBOS_000, e); } ExpressionNode expr = getChild(1); expr.evaluate(context); Object valueObject = context.stackPop(); if (ExpressionUtil.isNumeric(valueClass)) { try { valueObject = ExpressionUtil.getNumericReturnObject(valueObject, valueClass); } catch (ParsingException e) { throw new EvaluationException(ExceptionConstants.EBOS_000, e); } } else if (ExpressionUtil.isReferenceType(valueClass)) { if (valueObject != null && !valueClass.isAssignableFrom(valueObject.getClass())) { throw new EvaluationException( ExceptionConstants.EBOS_OOEE_006, new Object[] {valueObject.getClass(), valueClass}); } } context.stackPush(valueObject); }
public Class checkType(OOEEParsingContext context) throws ParsingException { ExpressionNode expr = getChild(0); Class exprClass = expr.checkType(context); ExpressionNode type = getChild(1); Class instanceClass = type.checkType(context); if (!ExpressionUtil.isReferenceType(exprClass) || !ExpressionUtil.isReferenceType(instanceClass) || !ExpressionUtil.isCastableFrom(instanceClass, exprClass)) { throw new ParsingException( ExceptionConstants.EBOS_OOEE_037, new Object[] {exprClass, instanceClass}); } instanceClassName = instanceClass.getName(); setValueClass(boolean.class); return valueClass; }