@@ -36,15 +36,36 @@ public interface Expression {
36
36
*/
37
37
public Object getValue () throws EvaluationException ;
38
38
39
+ /**
40
+ * Evaluate this expression against the specified root object
41
+ *
42
+ * @param rootObject the root object against which properties/etc will be resolved
43
+ * @return the evaluation result
44
+ * @throws EvaluationException if there is a problem during evaluation
45
+ */
46
+ public Object getValue (Object rootObject ) throws EvaluationException ;
47
+
39
48
/**
40
- * Evaluate the expression in the default standard context. If the result of the evaluation does not match (and
49
+ * Evaluate the expression in the default context. If the result of the evaluation does not match (and
41
50
* cannot be converted to) the expected result type then an exception will be returned.
42
51
*
43
52
* @param desiredResultType the class the caller would like the result to be
44
53
* @return the evaluation result
45
54
* @throws EvaluationException if there is a problem during evaluation
46
55
*/
47
56
public <T > T getValue (Class <T > desiredResultType ) throws EvaluationException ;
57
+
58
+ /**
59
+ * Evaluate the expression in the default context against the specified root object. If the
60
+ * result of the evaluation does not match (and cannot be converted to) the expected result type
61
+ * then an exception will be returned.
62
+ *
63
+ * @param rootObject the root object against which properties/etc will be resolved
64
+ * @param desiredResultType the class the caller would like the result to be
65
+ * @return the evaluation result
66
+ * @throws EvaluationException if there is a problem during evaluation
67
+ */
68
+ public <T > T getValue (Object rootObject , Class <T > desiredResultType ) throws EvaluationException ;
48
69
49
70
/**
50
71
* Evaluate this expression in the provided context and return the result of evaluation.
@@ -55,6 +76,17 @@ public interface Expression {
55
76
*/
56
77
public Object getValue (EvaluationContext context ) throws EvaluationException ;
57
78
79
+ /**
80
+ * Evaluate this expression in the provided context and return the result of evaluation, but use
81
+ * the supplied root context as an override for any default root object specified in the context.
82
+ *
83
+ * @param context the context in which to evaluate the expression
84
+ * @param rootObject the root object against which properties/etc will be resolved
85
+ * @return the evaluation result
86
+ * @throws EvaluationException if there is a problem during evaluation
87
+ */
88
+ public Object getValue (EvaluationContext context , Object rootObject ) throws EvaluationException ;
89
+
58
90
/**
59
91
* Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc -
60
92
* the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it
@@ -67,6 +99,20 @@ public interface Expression {
67
99
*/
68
100
public <T > T getValue (EvaluationContext context , Class <T > desiredResultType ) throws EvaluationException ;
69
101
102
+ /**
103
+ * Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc -
104
+ * the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it
105
+ * is not and cannot be converted to that type. The supplied root object overrides any default specified on the
106
+ * supplied context.
107
+ *
108
+ * @param context the context in which to evaluate the expression
109
+ * @param rootObject the root object against which properties/etc will be resolved
110
+ * @param desiredResultType the class the caller would like the result to be
111
+ * @return the evaluation result
112
+ * @throws EvaluationException if there is a problem during evaluation
113
+ */
114
+ public <T > T getValue (EvaluationContext context , Object rootObject , Class <T > desiredResultType ) throws EvaluationException ;
115
+
70
116
/**
71
117
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
72
118
* the default context.
@@ -76,6 +122,16 @@ public interface Expression {
76
122
*/
77
123
public Class getValueType () throws EvaluationException ;
78
124
125
+ /**
126
+ * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
127
+ * the default context.
128
+ *
129
+ * @param rootObject the root object against which to evaluate the expression
130
+ * @return the most general type of value that can be set on this context
131
+ * @throws EvaluationException if there is a problem determining the type
132
+ */
133
+ public Class getValueType (Object rootObject ) throws EvaluationException ;
134
+
79
135
/**
80
136
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method for
81
137
* the given context.
@@ -85,6 +141,17 @@ public interface Expression {
85
141
* @throws EvaluationException if there is a problem determining the type
86
142
*/
87
143
public Class getValueType (EvaluationContext context ) throws EvaluationException ;
144
+
145
+ /**
146
+ * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method for
147
+ * the given context. The supplied root object overrides any specified in the context.
148
+ *
149
+ * @param context the context in which to evaluate the expression
150
+ * @param rootObject the root object against which to evaluate the expression
151
+ * @return the most general type of value that can be set on this context
152
+ * @throws EvaluationException if there is a problem determining the type
153
+ */
154
+ public Class getValueType (EvaluationContext context , Object rootObject ) throws EvaluationException ;
88
155
89
156
/**
90
157
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
@@ -94,6 +161,16 @@ public interface Expression {
94
161
* @throws EvaluationException if there is a problem determining the type
95
162
*/
96
163
public TypeDescriptor getValueTypeDescriptor () throws EvaluationException ;
164
+
165
+ /**
166
+ * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
167
+ * the default context.
168
+ *
169
+ * @param rootObject the root object against which to evaluate the expression
170
+ * @return a type descriptor for the most general type of value that can be set on this context
171
+ * @throws EvaluationException if there is a problem determining the type
172
+ */
173
+ public TypeDescriptor getValueTypeDescriptor (Object rootObject ) throws EvaluationException ;
97
174
98
175
/**
99
176
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method for
@@ -105,6 +182,17 @@ public interface Expression {
105
182
*/
106
183
public TypeDescriptor getValueTypeDescriptor (EvaluationContext context ) throws EvaluationException ;
107
184
185
+ /**
186
+ * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method for
187
+ * the given context. The supplied root object overrides any specified in the context.
188
+ *
189
+ * @param context the context in which to evaluate the expression
190
+ * @param rootObject the root object against which to evaluate the expression
191
+ * @return a type descriptor for the most general type of value that can be set on this context
192
+ * @throws EvaluationException if there is a problem determining the type
193
+ */
194
+ public TypeDescriptor getValueTypeDescriptor (EvaluationContext context , Object rootObject ) throws EvaluationException ;
195
+
108
196
/**
109
197
* Determine if an expression can be written to, i.e. setValue() can be called.
110
198
*
@@ -113,7 +201,27 @@ public interface Expression {
113
201
* @throws EvaluationException if there is a problem determining if it is writable
114
202
*/
115
203
public boolean isWritable (EvaluationContext context ) throws EvaluationException ;
116
-
204
+
205
+ /**
206
+ * Determine if an expression can be written to, i.e. setValue() can be called.
207
+ * The supplied root object overrides any specified in the context.
208
+ *
209
+ * @param context the context in which the expression should be checked
210
+ * @param rootObject the root object against which to evaluate the expression
211
+ * @return true if the expression is writable
212
+ * @throws EvaluationException if there is a problem determining if it is writable
213
+ */
214
+ public boolean isWritable (EvaluationContext context , Object rootObject ) throws EvaluationException ;
215
+
216
+ /**
217
+ * Determine if an expression can be written to, i.e. setValue() can be called.
218
+ *
219
+ * @param rootObject the root object against which to evaluate the expression
220
+ * @return true if the expression is writable
221
+ * @throws EvaluationException if there is a problem determining if it is writable
222
+ */
223
+ public boolean isWritable (Object rootObject ) throws EvaluationException ;
224
+
117
225
/**
118
226
* Set this expression in the provided context to the value provided.
119
227
*
@@ -122,7 +230,27 @@ public interface Expression {
122
230
* @throws EvaluationException if there is a problem during evaluation
123
231
*/
124
232
public void setValue (EvaluationContext context , Object value ) throws EvaluationException ;
233
+
234
+ /**
235
+ * Set this expression in the provided context to the value provided.
236
+ *
237
+ * @param rootObject the root object against which to evaluate the expression
238
+ * @param value the new value
239
+ * @throws EvaluationException if there is a problem during evaluation
240
+ */
241
+ public void setValue (Object rootObject , Object value ) throws EvaluationException ;
125
242
243
+ /**
244
+ * Set this expression in the provided context to the value provided.
245
+ * The supplied root object overrides any specified in the context.
246
+ *
247
+ * @param context the context in which to set the value of the expression
248
+ * @param rootObject the root object against which to evaluate the expression
249
+ * @param value the new value
250
+ * @throws EvaluationException if there is a problem during evaluation
251
+ */
252
+ public void setValue (EvaluationContext context , Object rootObject , Object value ) throws EvaluationException ;
253
+
126
254
/**
127
255
* Returns the original string used to create this expression, unmodified.
128
256
*
0 commit comments