Clover Coverage Report - Checkstyle
Coverage timestamp: Fri May 9 2008 10:48:13 EST
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
13   142   11   1.18
2   56   0.85   11
11     1  
1    
 
  AuditEvent       Line # 39 92.3% 0.9230769
11.06 13 11 11 0.85
 
  ( 10 of 459)
 
1    ////////////////////////////////////////////////////////////////////////////////
2    // checkstyle: Checks Java source code for adherence to a set of rules.
3    // Copyright (C) 2001-2005 Oliver Burn
4    //
5    // This library is free software; you can redistribute it and/or
6    // modify it under the terms of the GNU Lesser General Public
7    // License as published by the Free Software Foundation; either
8    // version 2.1 of the License, or (at your option) any later version.
9    //
10    // This library is distributed in the hope that it will be useful,
11    // but WITHOUT ANY WARRANTY; without even the implied warranty of
12    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    // Lesser General Public License for more details.
14    //
15    // You should have received a copy of the GNU Lesser General Public
16    // License along with this library; if not, write to the Free Software
17    // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18    ////////////////////////////////////////////////////////////////////////////////
19    package com.puppycrawl.tools.checkstyle.api;
20   
21    import java.util.EventObject;
22   
23   
24    /**
25    * Raw event for audit.
26    * <p>
27    * <i>
28    * I'm not very satisfied about the design of this event since there are
29    * optional methods that will return null in most of the case. This will
30    * need some work to clean it up especially if we want to introduce
31    * a more sequential reporting action rather than a packet error
32    * reporting. This will allow for example to follow the process quickly
33    * in an interface or a servlet (yep, that's cool to run a check via
34    * a web interface in a source repository ;-)
35    * </i>
36    * @author <a href="mailto:stephane.bailliez@wanadoo.fr">Stephane Bailliez</a>
37    * @see AuditListener
38    */
 
39    public final class AuditEvent
40    extends EventObject
41    {
42    /** filename event associated with **/
43    private final String mFileName;
44    /** message associated with the event **/
45    private final LocalizedMessage mMessage;
46   
47    /**
48    * Creates a new instance.
49    * @param aSource the object that created the event
50    */
 
51  902 toggle public AuditEvent(Object aSource)
52    {
53  902 this(aSource, null);
54    }
55   
56    /**
57    * Creates a new <code>AuditEvent</code> instance.
58    * @param aSrc source of the event
59    * @param aFileName file associated with the event
60    */
 
61  1832 toggle public AuditEvent(Object aSrc, String aFileName)
62    {
63  1832 this(aSrc, aFileName, null);
64    }
65   
66    /**
67    * Creates a new <code>AuditEvent</code> instance.
68    *
69    * @param aSrc source of the event
70    * @param aFileName file associated with the event
71    * @param aMessage the actual message
72    */
 
73  4193 toggle public AuditEvent(Object aSrc, String aFileName, LocalizedMessage aMessage)
74    {
75  4193 super(aSrc);
76  4193 mFileName = aFileName;
77  4193 mMessage = aMessage;
78    }
79   
80    /**
81    * @return the file name currently being audited or null if there is
82    * no relation to a file.
83    */
 
84  2341 toggle public String getFileName()
85    {
86  2341 return mFileName;
87    }
88   
89    /**
90    * return the line number on the source file where the event occurred.
91    * This may be 0 if there is no relation to a file content.
92    * @return an integer representing the line number in the file source code.
93    */
 
94  2683 toggle public int getLine()
95    {
96  2683 return mMessage.getLineNo();
97    }
98   
99    /**
100    * return the message associated to the event.
101    * @return the event message
102    */
 
103  2332 toggle public String getMessage()
104    {
105  2332 return mMessage.getMessage();
106    }
107   
108    /** @return the column associated with the message **/
 
109  4070 toggle public int getColumn()
110    {
111  4070 return mMessage.getColumnNo();
112    }
113   
114    /** @return the audit event severity level **/
 
115  4675 toggle public SeverityLevel getSeverityLevel()
116    {
117  4675 return (mMessage == null)
118    ? SeverityLevel.INFO
119    : mMessage.getSeverityLevel();
120    }
121   
122    /**
123    * @return the identifier of the module that generated the event. Can return
124    * null.
125    */
 
126  0 toggle public String getModuleId()
127    {
128  0 return mMessage.getModuleId();
129    }
130   
131    /** @return the name of the source for the message **/
 
132  147 toggle public String getSourceName()
133    {
134  147 return mMessage.getSourceName();
135    }
136   
137