KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > gsf > DefaultError


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.spi.gsf;
20
21 import org.netbeans.api.gsf.Error;
22 import org.netbeans.api.gsf.Position;
23 import org.netbeans.api.gsf.Severity;
24 import org.netbeans.api.gsf.annotations.NonNull;
25 import org.netbeans.api.gsf.annotations.Nullable;
26 import org.openide.filesystems.FileObject;
27
28
29 /**
30  * Simple implementation of the Error interface, which can be used for convenience
31  * when generating errors during (for example) program parsing.
32  *
33  * @author Tor Norbye
34  */

35 public class DefaultError implements Error JavaDoc {
36     private String JavaDoc displayName;
37     private String JavaDoc description;
38
39     //private List<Fix> fixes;
40
private FileObject file;
41     private Position start;
42     private Position end;
43     private String JavaDoc key;
44     private Severity severity;
45     private Object JavaDoc[] parameters;
46
47     /** Creates a new instance of DefaultError */
48     public DefaultError(@Nullable
49     String JavaDoc key, @NonNull
50     String JavaDoc displayName, @Nullable
51     String JavaDoc description, @NonNull
52     FileObject file, @NonNull
53     Position start, @NonNull
54     Position end, @NonNull
55     Severity severity) {
56         this.key = key;
57         this.displayName = displayName;
58         this.description = description;
59         this.file = file;
60         this.start = start;
61         this.end = end;
62         this.severity = severity;
63     }
64
65     public String JavaDoc getDisplayName() {
66         return displayName;
67     }
68
69     public String JavaDoc getDescription() {
70         return description;
71     }
72
73     //public void addFix(Fix fix) {
74
// if (fixes == null) {
75
// fixes = new ArrayList<Fix>(5);
76
// }
77
// fixes.add(fix);
78
//}
79
//
80
//public List<Fix> getFixes() {
81
// return Collections.unmodifiableList(fixes);
82
//}
83

84     public Position getStartPosition() {
85         return start;
86     }
87
88     public Position getEndPosition() {
89         return end;
90     }
91
92     public String JavaDoc toString() {
93         return "DefaultError[" + displayName + ", " + description + ", " + severity + "]";
94     }
95
96     public String JavaDoc getKey() {
97         return key;
98     }
99
100     public Object JavaDoc[] getParameters() {
101         return parameters;
102     }
103
104     public void setParameters(final Object JavaDoc[] parameters) {
105         this.parameters = parameters;
106     }
107
108     public Severity getSeverity() {
109         return severity;
110     }
111
112     public FileObject getFile() {
113         return file;
114     }
115 }
116
Popular Tags