KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > language > programming > CompilerError


1 /*
2  * Copyright 1999-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 package org.apache.cocoon.components.language.programming;
17
18 /**
19  * This class encapsulates an error message produced by a programming language
20  * processor (whether interpreted or compiled)
21  * @author <a HREF="mailto:stefano@apache.org">Stefano Mazzocchi</a>
22  * @version CVS $Id: CompilerError.java 30932 2004-07-29 17:35:38Z vgritsenko $
23  * @since 2.0
24  */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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