KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > components > compiler > CompilerError


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
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  
17 package org.apache.axis.components.compiler;
18
19 /**
20  * This class encapsulates an error message produced by a programming language
21  * processor (whether interpreted or compiled)
22  * @author <a HREF="mailto:dims@yahoo.com">Davanum Srinivas</a>
23  * @author <a HREF="mailto:stefano@apache.org">Stefano Mazzocchi</a>
24  * @since 2.0
25  */

26
27 public class CompilerError {
28   /**
29    * Is this a severe error or a warning?
30    */

31   private boolean error;
32   /**
33    * The start line number of the offending program text
34    */

35   private int startline;
36   /**
37    * The start column number of the offending program text
38    */

39   private int startcolumn;
40   /**
41    * The end line number of the offending program text
42    */

43   private int endline;
44   /**
45    * The end column number of the offending program text
46    */

47   private int endcolumn;
48   /**
49    * The name of the file containing the offending program text
50    */

51   private String JavaDoc file;
52   /**
53    * The actual error text produced by the language processor
54    */

55   private String JavaDoc message;
56     
57   /**
58    * The error message constructor.
59    *
60    * @param file The name of the file containing the offending program text
61    * @param error The actual error text produced by the language processor
62    * @param startline The start line number of the offending program text
63    * @param startcolumn The start column number of the offending program text
64    * @param endline The end line number of the offending program text
65    * @param endcolumn The end column number of the offending program text
66    * @param message The actual error text produced by the language processor
67    */

68   public CompilerError(
69     String JavaDoc file,
70     boolean error,
71     int startline,
72     int startcolumn,
73     int endline,
74     int endcolumn,
75     String JavaDoc message
76   )
77   {
78     this.file = file;
79     this.error = error;
80     this.startline = startline;
81     this.startcolumn = startcolumn;
82     this.endline = endline;
83     this.endcolumn = endcolumn;
84     this.message = message;
85   }
86
87   /**
88    * The error message constructor.
89    *
90    * @param message The actual error text produced by the language processor
91    */

92   public CompilerError(String JavaDoc message) {
93     this.message = message;
94   }
95   
96   /**
97    * Return the filename associated with this compiler error.
98    *
99    * @return The filename associated with this compiler error
100    */

101   public String JavaDoc getFile() {
102     return file;
103   }
104
105   /**
106    * Assert whether this is a severe error or a warning
107    *
108    * @return Whether the error is severe
109    */

110   public boolean isError() {
111     return error;
112   }
113
114   /**
115    * Return the starting line number of the program text originating this error
116    *
117    * @return The starting line number of the program text originating this error
118    */

119   public int getStartLine() {
120     return startline;
121   }
122
123   /**
124    * Return the starting column number of the program text originating this
125    * error
126    *
127    * @return The starting column number of the program text originating this
128    * error
129    */

130   public int getStartColumn() {
131     return startcolumn;
132   }
133
134   /**
135    * Return the ending line number of the program text originating this error
136    *
137    * @return The ending line number of the program text originating this error
138    */

139   public int getEndLine() {
140     return endline;
141   }
142
143   /**
144    * Return the ending column number of the program text originating this
145    * error
146    *
147    * @return The ending column number of the program text originating this
148    * error
149    */

150   public int getEndColumn() {
151     return endcolumn;
152   }
153
154   /**
155    * Return the message produced by the language processor
156    *
157    * @return The message produced by the language processor
158    */

159   public String JavaDoc getMessage() {
160     return message;
161   }
162 }
163
Popular Tags