KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > project > validator > ValidationInfo


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20 package org.apache.cayenne.project.validator;
21
22 import org.apache.cayenne.project.ProjectPath;
23
24 /**
25  * ValidationInfo encapsulates information about a single node validation
26  * on the project tree.
27  *
28  * @author Andrus Adamchik
29  */

30 public class ValidationInfo {
31     public static final int VALID = 0;
32     public static final int WARNING = 1;
33     public static final int ERROR = 2;
34
35     protected ProjectPath path;
36     protected String JavaDoc message;
37     protected int severity;
38
39     /**
40      * Constructor for ValidationInfo.
41      */

42     public ValidationInfo(int severity, String JavaDoc message, ProjectPath path) {
43         this.severity = severity;
44         this.message = message;
45         this.path = path;
46     }
47
48     public Object JavaDoc getValidatedObject() {
49         return path.getObject();
50     }
51
52     public Object JavaDoc getValidatedObjectParent() {
53         return path.getObjectParent();
54     }
55
56     public String JavaDoc toString() {
57         return getMessage();
58     }
59
60     /**
61      * Returns the message.
62      * @return String
63      */

64     public String JavaDoc getMessage() {
65         return message;
66     }
67
68     /**
69      * Returns the severity.
70      * @return int
71      */

72     public int getSeverity() {
73         return severity;
74     }
75
76     /**
77      * Returns the ProjectPath object identifing a location
78      * described by this ValidationInfo.
79      */

80     public ProjectPath getPath() {
81         return path;
82     }
83 }
84
Popular Tags