Exemplo n.º 1
0
  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);
  }
Exemplo n.º 2
0
  protected void evaluateNode(OOEEEvaluationContext context) throws EvaluationException {
    try {
      getValueClass();
    } catch (ParsingException e) {
      throw new EvaluationException(ExceptionConstants.EBOS_000, e);
    }

    Class instanceClass = null;
    try {
      instanceClass = ExpressionUtil.findClass(instanceClassName);
    } catch (ParsingException e) {
      throw new EvaluationException(ExceptionConstants.EBOS_000, e);
    }

    ExpressionNode expr = getChild(0);

    expr.evaluate(context);

    Object exprObject = context.stackPop();

    Object valueObject = instanceClass.isInstance(exprObject) ? Boolean.TRUE : Boolean.FALSE;

    context.stackPush(valueObject);
  }