01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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,
43: int startLine, int startCoumn, int endLine, int endCoumn,
44: String message) {
45: this .message = message;
46: this .isError = isError;
47: this .fileName = fileName;
48: this .startCoumn = startCoumn;
49: this .endCoumn = endCoumn;
50: this .startLine = startLine;
51: this .endLine = endLine;
52: }
53:
54: public int getEndColumn() {
55: return endCoumn;
56: }
57:
58: public int getEndLine() {
59: return endLine;
60: }
61:
62: public String getFileName() {
63: return fileName;
64: }
65:
66: public String getMessage() {
67: return message;
68: }
69:
70: public int getStartColumn() {
71: return startCoumn;
72: }
73:
74: public int getStartLine() {
75: return startLine;
76: }
77:
78: public boolean isError() {
79: return isError;
80: }
81:
82: public String toString() {
83: final StringBuffer sb = new StringBuffer();
84: sb.append(getFileName()).append(" (");
85: sb.append(getStartLine());
86: sb.append(":");
87: sb.append(getStartColumn());
88: sb.append(") : ");
89: sb.append(getMessage());
90: return sb.toString();
91: }
92: }
|