| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public void setValue(ELContext context, Object base, Object property, Object value) { |
| 99 | Objects.requireNonNull(context); |
| 100 | |
| 101 | if (base != null && base.getClass().isArray()) { |
| 102 | context.setPropertyResolved(base, property); |
| 103 | |
| 104 | if (LENGTH_PROPERTY_NAME.equals(property)) { |
| 105 | throw new PropertyNotWritableException( |
| 106 | Util.message(context, "propertyNotWritable", base.getClass().getName(), property)); |
| 107 | } |
| 108 | |
| 109 | if (this.readOnly) { |
| 110 | throw new PropertyNotWritableException( |
| 111 | Util.message(context, "resolverNotWritable", base.getClass().getName())); |
| 112 | } |
| 113 | |
| 114 | int idx = coerce(property); |
| 115 | checkBounds(base, idx); |
| 116 | if (value != null && !Util.isAssignableFrom(value.getClass(), base.getClass().getComponentType())) { |
| 117 | throw new ClassCastException(Util.message(context, "objectNotAssignable", value.getClass().getName(), |
| 118 | base.getClass().getComponentType().getName())); |
| 119 | } |
| 120 | Array.set(base, idx, value); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public boolean isReadOnly(ELContext context, Object base, Object property) { |