/** * Performs some validation checks on a potential library function. * * @param name the {@link FullMethodName} that could contain the function */ @Check public void checkLibraryFunctionName(FullMethodName name) { if (name.eContainer() instanceof MethodInvocation) { MethodInvocation method = (MethodInvocation) name.eContainer(); if (method.eContainer() instanceof MethodsExpression) { MethodsExpression expression = (MethodsExpression) method.eContainer(); // TODO - Improve this check --> SEE also the method // JRExpressionsModelUtil.isFunctionLibrary(name) // For sake of simplicity assume the library functions are the first method invocation if (!expression.isIncludeObjectInstatiation() && (name.getPrefixQMN() == null || name.getPrefixQMN().size() == 0)) { if (expression.getObjectExpression() == null && method.equals(expression.getMethodInvocations().get(0))) { // Look in the function library if (!FunctionsLibraryUtil.existsFunction(name.getMethodName()) && !AdditionalStaticFunctions.getAllNames().contains(name.getMethodName())) { error( Messages.JavaJRExpressionJavaValidator_FunctionNotFoundError, name, JavaJRExpressionPackage.Literals.FULL_METHOD_NAME__METHOD_NAME, JavaJRExpressionPackage.FULL_METHOD_NAME__METHOD_NAME); } // else{ // // TODO - Check for parameters // // We should add the verification for the number of parameters. // // Keep in mind that the JRExprFunctionBean contains a list of // // parameters, and each of them can be multi/optional. // } } } } } }