{@inheritDoc} @return If the base object is an Optional and Optional#isEmpty() returns true then this method returns null. If the base object is an Optional and Optional#isPresent() returns true then
(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params)
| 208 | * If the base object is not an {@link Optional} then the return value is undefined. |
| 209 | */ |
| 210 | @Override |
| 211 | public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { |
| 212 | Objects.requireNonNull(context); |
| 213 | |
| 214 | if (base instanceof Optional && method != null) { |
| 215 | context.setPropertyResolved(base, method); |
| 216 | if (((Optional<?>) base).isEmpty()) { |
| 217 | return null; |
| 218 | } else { |
| 219 | Object resolvedBase = ((Optional<?>) base).get(); |
| 220 | return context.getELResolver().invoke(context, resolvedBase, method, paramTypes, params); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | return null; |
| 225 | } |
| 226 | } |
nothing calls this directly
no test coverage detected