KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > binding > expression > EvaluationAttempt


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.binding.expression;
17
18 import java.io.Serializable JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import org.springframework.core.style.ToStringCreator;
22
23 /**
24  * A simple holder for information about an evaluation attempt.
25  * @author Keith Donald
26  */

27 public class EvaluationAttempt implements Serializable JavaDoc {
28
29     /**
30      * The expression that attempted to evaluate.
31      */

32     private Expression expression;
33
34     /**
35      * The target object being evaluated.
36      */

37     private Object JavaDoc target;
38
39     /**
40      * The evaluation attributes.
41      */

42     private Map JavaDoc evaluationAttributes;
43
44     /**
45      * Create an evaluation attempt.
46      * @param expression the expression that failed to evaluate
47      * @param target the target of the expression
48      * @param evaluationAttributes the attributes that might have affected
49      * evaluation behavior
50      */

51     public EvaluationAttempt(Expression expression, Object JavaDoc target, Map JavaDoc evaluationAttributes) {
52         this.expression = expression;
53         this.target = target;
54         this.evaluationAttributes = evaluationAttributes;
55     }
56
57     /**
58      * Returns the expression that attempted to evaluate.
59      */

60     public Expression getExpression() {
61         return expression;
62     }
63
64     /**
65      * Returns the target object upon which evaluation was attempted.
66      */

67     public Object JavaDoc getTarget() {
68         return target;
69     }
70
71     /**
72      * Returns attributes that may have influenced the evaluation process.
73      */

74     public Map JavaDoc getEvaluationAttributes() {
75         return evaluationAttributes;
76     }
77
78     public String JavaDoc toString() {
79         return createToString(new ToStringCreator(this)).toString();
80     }
81
82     protected ToStringCreator createToString(ToStringCreator creator) {
83         return creator.append("expression", expression).append("target", target).append("evaluationAttributes",
84                 evaluationAttributes);
85     }
86 }
Popular Tags