KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hammurapi > InspectorContext


1 /*
2   * Hammurapi
3  * Automated Java code review system.
4  * Copyright (C) 2004 Hammurapi Group
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * URL: http://www.hammurapi.org
21  * e-Mail: support@hammurapi.biz
22  */

23 package org.hammurapi;
24
25 import org.hammurapi.results.Annotation;
26
27 import com.pavelvlasov.review.Signed;
28 import com.pavelvlasov.review.SourceMarker;
29 import com.pavelvlasov.util.Attributable;
30 import com.pavelvlasov.util.VisitorStack;
31
32 /**
33  * @author Pavel Vlasov
34  * @version $Revision: 1.8 $
35  */

36 public interface InspectorContext extends Attributable {
37     InspectorDescriptor getDescriptor();
38
39     /**
40      * Reports violation with a message from descriptor
41      * @param source
42      */

43     void reportViolation(SourceMarker source);
44
45     /**
46      * Reports violation with a message from descriptor
47      * @param source
48      */

49     void reportViolationEx(SourceMarker source, String JavaDoc messageKey);
50
51     /**
52      *
53      * @param source
54      * @param message
55      */

56     void reportViolation(SourceMarker source, String JavaDoc message);
57
58     void annotate(Annotation annotation);
59
60     void addMetric(SourceMarker source, String JavaDoc name, double value);
61
62     /**
63      * Formats message taken from InspectorDescriptor with parameters.
64      * @param source
65      * @param params
66      */

67     void reportViolation(SourceMarker source, Object JavaDoc[] params);
68
69     /**
70      * Formats message taken from InspectorDescriptor with parameters.
71      * @param source
72      * @param params
73      */

74     void reportViolationEx(SourceMarker source, Object JavaDoc[] params,
75             String JavaDoc messageKey);
76
77     /**
78      * Report warning
79      * @param source
80      * @param message
81      */

82     void warn(SourceMarker source, String JavaDoc message);
83
84     /**
85      * Report warning
86      * @param source
87      * @param message
88      */

89     void warn(SourceMarker source, Throwable JavaDoc th);
90
91     /**
92      * Outputs a message to the log
93      * @param source
94      * @param message
95      */

96     void info(SourceMarker source, String JavaDoc message);
97
98     /**
99      * Outputs a message to the log
100      * @param source
101      * @param message
102      */

103     void debug(SourceMarker source, String JavaDoc message);
104
105     /**
106      * Outputs a message to the log
107      * @param source
108      * @param message
109      */

110     void verbose(SourceMarker source, String JavaDoc message);
111
112     /**
113      * Creates a waiver for inspector with a given key
114      * @param inspectorKey
115      */

116     void waive(Signed signed, final String JavaDoc inspectorKey);
117
118     /**
119      * Visitor stack of the master visitor
120      * @return
121      */

122     VisitorStack getVisitorStack();
123     
124     Session getSession();
125     
126     /**
127      * Helper method to avoid hard reference to Jsel objects.
128      * @param source
129      * @return
130      */

131     public SourceMarker detach(final SourceMarker source);
132 }
Popular Tags