(EvaluationContext ctx)
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public Object getValue(EvaluationContext ctx) throws ELException { |
| 78 | |
| 79 | FunctionMapper fnMapper = ctx.getFunctionMapper(); |
| 80 | |
| 81 | // quickly validate again for this request |
| 82 | if (fnMapper == null) { |
| 83 | throw new ELException(MessageFactory.get("error.fnMapper.null")); |
| 84 | } |
| 85 | Method m = fnMapper.resolveFunction(this.prefix, this.localName); |
| 86 | |
| 87 | if (m == null && this.prefix.isEmpty()) { |
| 88 | // TODO: Do we need to think about precedence of the various ways |
| 89 | // a lambda expression may be obtained from something that |
| 90 | // the parser thinks is a function? |
| 91 | Object obj = null; |
| 92 | if (ctx.isLambdaArgument(this.localName)) { |
| 93 | obj = ctx.getLambdaArgument(this.localName); |
| 94 | } |
| 95 | if (obj == null) { |
| 96 | VariableMapper varMapper = ctx.getVariableMapper(); |
| 97 | if (varMapper != null) { |
| 98 | obj = varMapper.resolveVariable(this.localName); |
| 99 | if (obj != null) { |
| 100 | // See if this returns a LambdaExpression |
| 101 | obj = ((ValueExpression) obj).getValue(ctx); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | if (obj == null) { |
| 106 | obj = ctx.getELResolver().getValue(ctx, null, this.localName); |
| 107 | } |
| 108 | if (obj instanceof LambdaExpression) { |
| 109 | // Build arguments |
| 110 | int i = 0; |
| 111 | while (obj instanceof LambdaExpression && i < jjtGetNumChildren()) { |
| 112 | Node args = jjtGetChild(i); |
| 113 | obj = ((LambdaExpression) obj).invoke(((AstMethodParameters) args).getParameters(ctx)); |
| 114 | i++; |
| 115 | } |
| 116 | if (i < jjtGetNumChildren()) { |
| 117 | // Haven't consumed all the sets of parameters therefore |
| 118 | // there were too many sets of parameters |
| 119 | throw new ELException(MessageFactory.get("error.lambda.tooManyMethodParameterSets")); |
| 120 | } |
| 121 | return obj; |
| 122 | } |
| 123 | |
| 124 | // Call to a constructor or a static method |
| 125 | obj = ctx.getImportHandler().resolveClass(this.localName); |
| 126 | if (obj != null) { |
| 127 | return ctx.getELResolver().invoke(ctx, new ELClass((Class<?>) obj), "<init>", null, |
| 128 | ((AstMethodParameters) this.children[0]).getParameters(ctx)); |
| 129 | } |
| 130 | obj = ctx.getImportHandler().resolveStatic(this.localName); |
| 131 | if (obj != null) { |
| 132 | return ctx.getELResolver().invoke(ctx, new ELClass((Class<?>) obj), this.localName, null, |
| 133 | ((AstMethodParameters) this.children[0]).getParameters(ctx)); |
nothing calls this directly
no test coverage detected