RuleViolation.java
001 /**
002  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
003  */
004 package net.sourceforge.pmd;
005 
006 /**
007  * A RuleViolation is created by a Rule when it identifies a violation of the
008  * Rule constraints.
009  * 
010  * @see Rule
011  */
012 public interface RuleViolation {
013 
014     /**
015      * Get the Rule which identified this violation.
016      * @return The identifying Rule.
017      */
018     Rule getRule();
019 
020     /**
021      * Get the description of this violation.
022      * 
023      * @return The description.
024      */
025     String getDescription();
026 
027     /**
028      * Indicates whether this violation has been suppressed.
029      * @return <code>true</code> if this violation is suppressed, <code>false</code> otherwise.
030      */
031     boolean isSuppressed();
032 
033     /**
034      * Get the source file name in which this violation was identified.
035      * 
036      * @return The source file name.
037      */
038     String getFilename();
039 
040     /**
041      * Get the begin line number in the source file in which this violation was
042      * identified.
043      * 
044      * @return Begin line number.
045      */
046     int getBeginLine();
047 
048     /**
049      * Get the column number of the begin line in the source file
050      * in which this violation was identified.
051      * 
052      * @return Begin column number.
053      */
054     int getBeginColumn();
055 
056     /**
057      * Get the end line number in the source file in which this violation was
058      * identified.
059      * 
060      * @return End line number.
061      */
062     int getEndLine();
063 
064     /**
065      * Get the column number of the end line in the source file
066      * in which this violation was identified.
067      * 
068      * @return End column number.
069      */
070     int getEndColumn();
071 
072     /**
073      * Get the package name of the Class in which this violation was identified.
074      * 
075      * @return The package name.
076      */
077     // TODO Isn't this Java specific?
078     String getPackageName();
079 
080     /**
081      * Get the name of the Class in which this violation was identified.
082      * 
083      * @return The Class name.
084      */
085     // TODO Isn't this Java specific?
086     String getClassName();
087 
088     /**
089      * Get the method name in which this violation was identified.
090      * 
091      * @return The method name.
092      */
093     // TODO Isn't this Java specific?
094     String getMethodName();
095 
096     /**
097      * Get the variable name on which this violation was identified.
098      * 
099      * @return The variable name.
100      */
101     String getVariableName();
102 }