(EvaluationContext ctx)
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public Object getValue(EvaluationContext ctx) throws ELException { |
| 59 | // Lambda parameters |
| 60 | if (ctx.isLambdaArgument(this.image)) { |
| 61 | return ctx.getLambdaArgument(this.image); |
| 62 | } |
| 63 | |
| 64 | // Variable mapper |
| 65 | VariableMapper varMapper = ctx.getVariableMapper(); |
| 66 | if (varMapper != null) { |
| 67 | ValueExpression expr = varMapper.resolveVariable(this.image); |
| 68 | if (expr != null) { |
| 69 | return expr.getValue(ctx.getELContext()); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // EL Resolvers |
| 74 | ctx.setPropertyResolved(false); |
| 75 | Object result; |
| 76 | /* |
| 77 | * Putting the Boolean into the ELContext is part of a performance optimisation for ScopedAttributeELResolver. |
| 78 | * When looking up "foo", the resolver can't differentiate between ${ foo } and ${ foo.bar }. This is important |
| 79 | * because the expensive class lookup only needs to be performed in the later case. This flag tells the resolver |
| 80 | * if the lookup can be skipped. |
| 81 | */ |
| 82 | if (parent instanceof AstValue) { |
| 83 | ctx.putContext(this.getClass(), Boolean.FALSE); |
| 84 | } else { |
| 85 | ctx.putContext(this.getClass(), Boolean.TRUE); |
| 86 | } |
| 87 | try { |
| 88 | result = ctx.getELResolver().getValue(ctx, null, this.image); |
| 89 | } finally { |
| 90 | // Always reset the flag to false so the optimisation is not applied |
| 91 | // inappropriately |
| 92 | ctx.putContext(this.getClass(), Boolean.FALSE); |
| 93 | } |
| 94 | |
| 95 | if (ctx.isPropertyResolved()) { |
| 96 | return result; |
| 97 | } |
| 98 | |
| 99 | // Import |
| 100 | result = ctx.getImportHandler().resolveClass(this.image); |
| 101 | if (result != null) { |
| 102 | return new ELClass((Class<?>) result); |
| 103 | } |
| 104 | result = ctx.getImportHandler().resolveStatic(this.image); |
| 105 | if (result != null) { |
| 106 | try { |
| 107 | return ((Class<?>) result).getField(this.image).get(null); |
| 108 | } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { |
| 109 | throw new ELException(e); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled.null", this.image)); |
| 114 | } |
nothing calls this directly
no test coverage detected