(ELContext context, Object base, Object property)
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public Object getValue(ELContext context, Object base, Object property) { |
| 56 | Objects.requireNonNull(context); |
| 57 | |
| 58 | Object result = null; |
| 59 | |
| 60 | if (base == null) { |
| 61 | if (property != null) { |
| 62 | boolean resolveClass = true; |
| 63 | // Performance short-cut available when running on Tomcat |
| 64 | if (AST_IDENTIFIER_KEY != null) { |
| 65 | // Tomcat will set this key to Boolean.TRUE if the |
| 66 | // identifier is a stand-alone identifier (i.e. |
| 67 | // identifier) rather than part of an AstValue (i.e. |
| 68 | // identifier.something). Imports do not need to be |
| 69 | // checked if this is a stand-alone identifier |
| 70 | Boolean value = (Boolean) context.getContext(AST_IDENTIFIER_KEY); |
| 71 | if (value != null && value.booleanValue()) { |
| 72 | resolveClass = false; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | ImportHandler importHandler = context.getImportHandler(); |
| 77 | if (importHandler != null) { |
| 78 | String key = property.toString(); |
| 79 | Class<?> clazz; |
| 80 | if (resolveClass) { |
| 81 | clazz = importHandler.resolveClass(key); |
| 82 | if (clazz != null) { |
| 83 | result = new ELClass(clazz); |
| 84 | } |
| 85 | } |
| 86 | if (result == null) { |
| 87 | // This might be the name of an imported static field |
| 88 | clazz = importHandler.resolveStatic(key); |
| 89 | if (clazz != null) { |
| 90 | try { |
| 91 | result = clazz.getField(key).get(null); |
| 92 | } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | |
| 93 | SecurityException e) { |
| 94 | // Most (all?) of these should have been |
| 95 | // prevented by the checks when the import |
| 96 | // was defined. |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | if (result != null) { |
| 105 | context.setPropertyResolved(base, property); |
| 106 | } |
| 107 | |
| 108 | return result; |
| 109 | } |
| 110 | |
| 111 | @Override |
nothing calls this directly
no test coverage detected