| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public Class<?> getType(ELContext context, Object base, Object property) { |
| 49 | Objects.requireNonNull(context); |
| 50 | |
| 51 | if (base != null && base.getClass().isArray()) { |
| 52 | context.setPropertyResolved(base, property); |
| 53 | |
| 54 | if (LENGTH_PROPERTY_NAME.equals(property)) { |
| 55 | // Always read-only |
| 56 | return null; |
| 57 | } |
| 58 | |
| 59 | try { |
| 60 | int idx = coerce(property); |
| 61 | checkBounds(base, idx); |
| 62 | } catch (IllegalArgumentException e) { |
| 63 | // ignore |
| 64 | } |
| 65 | /* |
| 66 | * The resolver may have been created in read-only mode but the array and its elements will always be |
| 67 | * read-write. |
| 68 | */ |
| 69 | if (readOnly) { |
| 70 | return null; |
| 71 | } |
| 72 | return base.getClass().getComponentType(); |
| 73 | } |
| 74 | |
| 75 | return null; |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public Object getValue(ELContext context, Object base, Object property) { |