View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.jci.compilers;
19  
20  import org.apache.commons.jci.problems.CompilationProblem;
21  
22  /**
23   * 
24   * @author tcurdt
25   */
26  public class JavacCompilationProblem implements CompilationProblem {
27  
28      private int endCoumn;
29      private int endLine;
30      private String fileName;
31      private String message;
32      private int startCoumn;
33      private int startLine;
34      private boolean isError;
35  
36      public JavacCompilationProblem(String message, boolean isError) {
37          this.message = message;
38          this.isError = isError;
39          this.fileName = "";
40      }
41  
42      public JavacCompilationProblem(String fileName, boolean isError, int startLine, int startCoumn, int endLine, int endCoumn, String message) {
43          this.message = message;
44          this.isError = isError;
45          this.fileName = fileName;
46          this.startCoumn = startCoumn;
47          this.endCoumn = endCoumn;
48          this.startLine = startLine;
49          this.endLine = endLine;
50      }
51  
52      public int getEndColumn() {
53          return endCoumn;
54      }
55  
56      public int getEndLine() {
57          return endLine;
58      }
59  
60      public String getFileName() {
61          return fileName;
62      }
63  
64      public String getMessage() {
65          return message;
66      }
67  
68      public int getStartColumn() {
69          return startCoumn;
70      }
71  
72      public int getStartLine() {
73          return startLine;
74      }
75  
76      public boolean isError() {
77          return isError;
78      }
79  
80      public String toString() {
81          final StringBuffer sb = new StringBuffer();
82          sb.append(getFileName()).append(" (");
83          sb.append(getStartLine());
84          sb.append(":");
85          sb.append(getStartColumn());
86          sb.append(") : ");
87          sb.append(getMessage());
88          return sb.toString();
89      }
90  }