@@ -36,15 +36,36 @@ public interface Expression {
3636 */
3737 public Object getValue () throws EvaluationException ;
3838
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+
3948 /**
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
4150 * cannot be converted to) the expected result type then an exception will be returned.
4251 *
4352 * @param desiredResultType the class the caller would like the result to be
4453 * @return the evaluation result
4554 * @throws EvaluationException if there is a problem during evaluation
4655 */
4756 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 ;
4869
4970 /**
5071 * Evaluate this expression in the provided context and return the result of evaluation.
@@ -55,6 +76,17 @@ public interface Expression {
5576 */
5677 public Object getValue (EvaluationContext context ) throws EvaluationException ;
5778
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+
5890 /**
5991 * Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc -
6092 * 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 {
6799 */
68100 public <T > T getValue (EvaluationContext context , Class <T > desiredResultType ) throws EvaluationException ;
69101
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+
70116 /**
71117 * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
72118 * the default context.
@@ -76,6 +122,16 @@ public interface Expression {
76122 */
77123 public Class getValueType () throws EvaluationException ;
78124
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+
79135 /**
80136 * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method for
81137 * the given context.
@@ -85,6 +141,17 @@ public interface Expression {
85141 * @throws EvaluationException if there is a problem determining the type
86142 */
87143 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 ;
88155
89156 /**
90157 * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using
@@ -94,6 +161,16 @@ public interface Expression {
94161 * @throws EvaluationException if there is a problem determining the type
95162 */
96163 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 ;
97174
98175 /**
99176 * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method for
@@ -105,6 +182,17 @@ public interface Expression {
105182 */
106183 public TypeDescriptor getValueTypeDescriptor (EvaluationContext context ) throws EvaluationException ;
107184
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+
108196 /**
109197 * Determine if an expression can be written to, i.e. setValue() can be called.
110198 *
@@ -113,7 +201,27 @@ public interface Expression {
113201 * @throws EvaluationException if there is a problem determining if it is writable
114202 */
115203 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+
117225 /**
118226 * Set this expression in the provided context to the value provided.
119227 *
@@ -122,7 +230,27 @@ public interface Expression {
122230 * @throws EvaluationException if there is a problem during evaluation
123231 */
124232 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 ;
125242
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+
126254 /**
127255 * Returns the original string used to create this expression, unmodified.
128256 *
0 commit comments