@@ -78,7 +78,8 @@ public ValueRef getValueRef(ExpressionState state) throws EvaluationException {
78
78
79
79
@ Override
80
80
public TypedValue getValueInternal (ExpressionState state ) throws EvaluationException {
81
- TypedValue tv = getValueInternal (state .getActiveContextObject (), state .getEvaluationContext (), state .getConfiguration ().isAutoGrowNullReferences ());
81
+ TypedValue tv = getValueInternal (state .getActiveContextObject (), state .getEvaluationContext (),
82
+ state .getConfiguration ().isAutoGrowNullReferences ());
82
83
if (this .cachedReadAccessor instanceof CompilablePropertyAccessor ) {
83
84
CompilablePropertyAccessor accessor = (CompilablePropertyAccessor ) this .cachedReadAccessor ;
84
85
this .exitTypeDescriptor = CodeFlow .toDescriptor (accessor .getPropertyType ());
@@ -100,7 +101,7 @@ private TypedValue getValueInternal(TypedValue contextObject, EvaluationContext
100
101
// Create a new collection or map ready for the indexer
101
102
if (resultDescriptor .getType ().equals (List .class )) {
102
103
try {
103
- if (isWritableProperty (this .name ,contextObject ,eContext )) {
104
+ if (isWritableProperty (this .name , contextObject ,eContext )) {
104
105
List <?> newList = ArrayList .class .newInstance ();
105
106
writeProperty (contextObject , eContext , this .name , newList );
106
107
result = readProperty (contextObject , eContext , this .name );
@@ -156,12 +157,12 @@ private TypedValue getValueInternal(TypedValue contextObject, EvaluationContext
156
157
}
157
158
158
159
@ Override
159
- public void setValue (ExpressionState state , Object newValue ) throws SpelEvaluationException {
160
+ public void setValue (ExpressionState state , Object newValue ) throws EvaluationException {
160
161
writeProperty (state .getActiveContextObject (), state .getEvaluationContext (), this .name , newValue );
161
162
}
162
163
163
164
@ Override
164
- public boolean isWritable (ExpressionState state ) throws SpelEvaluationException {
165
+ public boolean isWritable (ExpressionState state ) throws EvaluationException {
165
166
return isWritableProperty (this .name , state .getActiveContextObject (), state .getEvaluationContext ());
166
167
}
167
168
@@ -173,9 +174,11 @@ public String toStringAST() {
173
174
/**
174
175
* Attempt to read the named property from the current context object.
175
176
* @return the value of the property
176
- * @throws SpelEvaluationException if any problem accessing the property or it cannot be found
177
+ * @throws EvaluationException if any problem accessing the property or it cannot be found
177
178
*/
178
- private TypedValue readProperty (TypedValue contextObject , EvaluationContext eContext , String name ) throws EvaluationException {
179
+ private TypedValue readProperty (TypedValue contextObject , EvaluationContext eContext , String name )
180
+ throws EvaluationException {
181
+
179
182
Object targetObject = contextObject .getValue ();
180
183
if (targetObject == null && this .nullSafe ) {
181
184
return TypedValue .NULL ;
@@ -193,7 +196,8 @@ private TypedValue readProperty(TypedValue contextObject, EvaluationContext eCon
193
196
}
194
197
}
195
198
196
- List <PropertyAccessor > accessorsToTry = getPropertyAccessorsToTry (contextObject .getValue (), eContext .getPropertyAccessors ());
199
+ List <PropertyAccessor > accessorsToTry =
200
+ getPropertyAccessorsToTry (contextObject .getValue (), eContext .getPropertyAccessors ());
197
201
// Go through the accessors that may be able to resolve it. If they are a cacheable accessor then
198
202
// get the accessor and use it. If they are not cacheable but report they can read the property
199
203
// then ask them to read it
@@ -223,7 +227,9 @@ private TypedValue readProperty(TypedValue contextObject, EvaluationContext eCon
223
227
}
224
228
}
225
229
226
- private void writeProperty (TypedValue contextObject , EvaluationContext eContext , String name , Object newValue ) throws SpelEvaluationException {
230
+ private void writeProperty (TypedValue contextObject , EvaluationContext eContext , String name , Object newValue )
231
+ throws EvaluationException {
232
+
227
233
if (contextObject .getValue () == null && this .nullSafe ) {
228
234
return ;
229
235
}
@@ -241,7 +247,8 @@ private void writeProperty(TypedValue contextObject, EvaluationContext eContext,
241
247
}
242
248
}
243
249
244
- List <PropertyAccessor > accessorsToTry = getPropertyAccessorsToTry (contextObject .getValue (), eContext .getPropertyAccessors ());
250
+ List <PropertyAccessor > accessorsToTry =
251
+ getPropertyAccessorsToTry (contextObject .getValue (), eContext .getPropertyAccessors ());
245
252
if (accessorsToTry != null ) {
246
253
try {
247
254
for (PropertyAccessor accessor : accessorsToTry ) {
@@ -266,8 +273,11 @@ private void writeProperty(TypedValue contextObject, EvaluationContext eContext,
266
273
}
267
274
}
268
275
269
- public boolean isWritableProperty (String name , TypedValue contextObject , EvaluationContext eContext ) throws SpelEvaluationException {
270
- List <PropertyAccessor > accessorsToTry = getPropertyAccessorsToTry (contextObject .getValue (), eContext .getPropertyAccessors ());
276
+ public boolean isWritableProperty (String name , TypedValue contextObject , EvaluationContext eContext )
277
+ throws EvaluationException {
278
+
279
+ List <PropertyAccessor > accessorsToTry =
280
+ getPropertyAccessorsToTry (contextObject .getValue (), eContext .getPropertyAccessors ());
271
281
if (accessorsToTry != null ) {
272
282
for (PropertyAccessor accessor : accessorsToTry ) {
273
283
try {
@@ -360,8 +370,8 @@ public AccessorLValue(PropertyOrFieldReference propertyOrFieldReference, TypedVa
360
370
@ Override
361
371
public TypedValue getValue () {
362
372
TypedValue value = this .ref .getValueInternal (this .contextObject , this .eContext , this .autoGrowNullReferences );
363
- if (ref .cachedReadAccessor instanceof CompilablePropertyAccessor ) {
364
- CompilablePropertyAccessor accessor = (CompilablePropertyAccessor )this .ref .cachedReadAccessor ;
373
+ if (this . ref .cachedReadAccessor instanceof CompilablePropertyAccessor ) {
374
+ CompilablePropertyAccessor accessor = (CompilablePropertyAccessor ) this .ref .cachedReadAccessor ;
365
375
this .ref .exitTypeDescriptor = CodeFlow .toDescriptor (accessor .getPropertyType ());
366
376
}
367
377
return value ;
0 commit comments