private String createCodeForFunctionApplication(FunctionApplication funApp) {
    addImports("de.uni_koblenz.jgralab.greql2.funlib.FunLib");

    // create static field to access function
    FunctionId funId = (FunctionId) funApp.getFirst_isFunctionIdOf_omega().getThat();
    Function function = FunLib.getFunctionInfo(funId.get_name()).getFunction();
    String functionName = function.getClass().getName();
    String functionSimpleName = function.getClass().getSimpleName();
    if (functionSimpleName.contains("."))
      functionSimpleName = functionSimpleName.substring(functionSimpleName.lastIndexOf("."));
    addStaticField(
        functionName,
        functionSimpleName + "_" + functionNumber,
        "("
            + functionName
            + ") FunLib.getFunctionInfo(\""
            + funId.get_name()
            + "\").getFunction()");
    // create code list to evaluate function
    CodeList list = new CodeList();
    list.add(new CodeSnippet("return " + functionSimpleName + "_" + functionNumber + ".evaluate("));
    functionNumber++;
    String delim = "";
    Method[] methods = function.getClass().getMethods();
    Method evaluateMethod = null;
    for (Method m : methods) {
      if (m.getName() == "evaluate") evaluateMethod = m;
    }
    Class<?>[] paramTypes = evaluateMethod.getParameterTypes();
    int currentParam = 0;
    for (IsArgumentOf_isArgumentOf_omega argInc :
        funApp.getIsArgumentOf_isArgumentOf_omegaIncidences()) {
      Expression expr = (Expression) argInc.getThat();
      CodeSnippet argEvalSnippet = new CodeSnippet();
      String cast = "(" + paramTypes[currentParam++].getCanonicalName() + ")";
      argEvalSnippet.add("\t\t" + delim + cast + createCodeForExpression(expr));
      delim = ",";
      list.add(argEvalSnippet);
    }
    list.add(new CodeSnippet(");"));

    return createMethod(list);
  }