コード例 #1
0
  /** @see org.vedantatree.expressionoasis.expressions.UnaryOperatorExpression#validate() */
  @Override
  protected void validate(ExpressionContext expressionContext) throws ExpressionEngineException {
    // Initializes the function provider.
    ParanthesisExpression argsExpression = (ParanthesisExpression) getOperandExpression();
    List<Type> types = new ArrayList<Type>();
    List values = new ArrayList();
    populateTypesAndValues(argsExpression.getOperandExpression(), types, values);

    Type[] parameterTypes = (Type[]) types.toArray(new Type[types.size()]);

    for (Iterator functionProviders = expressionContext.getFunctionProviders().iterator();
        functionProviders.hasNext(); ) {
      FunctionProvider functionProvider = (FunctionProvider) functionProviders.next();

      if (functionProvider.supportsFunction(functionName, parameterTypes)) {
        this.functionProvider = functionProvider;

        break;
      }
    }

    if (functionProvider == null) {
      throw new ExpressionEngineException(
          "No Function Provider exists for function: ["
              + MethodKey.generateKey(functionName, parameterTypes)
              + "]");
    }
  }
コード例 #2
0
 /**
  * @see
  *     org.vedantatree.expressionoasis.expressions.Expression#initialize(org.vedantatree.expressionoasis.ExpressionContext,
  *     java.lang.Object)
  */
 @Override
 public void initialize(ExpressionContext expressionContext, Object parameters, boolean validate)
     throws ExpressionEngineException {
   functionName = (String) expressionContext.getContextProperty("TOKEN");
   super.initialize(expressionContext, parameters, validate);
 }