{@inheritDoc} @return If the base object is an Optional and Optional#isEmpty() returns true then the resulting value is null. If the base object is an Optional, Optional#isPresent() returns true and the
(ELContext context, Object base, Object property)
| 59 | * If the base object is not an {@link Optional} then the return value is undefined. |
| 60 | */ |
| 61 | @Override |
| 62 | public Object getValue(ELContext context, Object base, Object property) { |
| 63 | Objects.requireNonNull(context); |
| 64 | |
| 65 | if (base instanceof Optional) { |
| 66 | context.setPropertyResolved(base, property); |
| 67 | if (((Optional<?>) base).isPresent()) { |
| 68 | if (property == null) { |
| 69 | return ((Optional<?>) base).get(); |
| 70 | } else { |
| 71 | Object resolvedBase = ((Optional<?>) base).get(); |
| 72 | return context.getELResolver().getValue(context, resolvedBase, property); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | return null; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | /** |
nothing calls this directly
no test coverage detected