| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public Object getValue(ELContext context, Object base, Object property) { |
| 44 | Objects.requireNonNull(context); |
| 45 | |
| 46 | if (base instanceof ELClass && property instanceof String name) { |
| 47 | context.setPropertyResolved(base, property); |
| 48 | |
| 49 | Class<?> clazz = ((ELClass) base).getKlass(); |
| 50 | Exception exception = null; |
| 51 | try { |
| 52 | Field field = clazz.getField(name); |
| 53 | int modifiers = field.getModifiers(); |
| 54 | if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers) && Util.canAccess(null, field)) { |
| 55 | return field.get(null); |
| 56 | } |
| 57 | } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { |
| 58 | exception = e; |
| 59 | } |
| 60 | String msg = Util.message(context, "staticFieldELResolver.notFound", name, clazz.getName()); |
| 61 | if (exception == null) { |
| 62 | throw new PropertyNotFoundException(msg); |
| 63 | } else { |
| 64 | throw new PropertyNotFoundException(msg, exception); |
| 65 | } |
| 66 | } |
| 67 | return null; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | @Override |