hudson.plugins.violations.model
Class Violation

java.lang.Object
  extended by hudson.plugins.violations.model.Violation
All Implemented Interfaces:
java.lang.Comparable<Violation>

public class Violation
extends java.lang.Object
implements java.lang.Comparable<Violation>

A class contains information on a violation.


Constructor Summary
Violation()
           
 
Method Summary
 int compareTo(Violation other)
          Compare to another violation.
 int getLine()
          Get the line number where the violation occurred.
 java.lang.String getMessage()
          Get the message to used when displaying the violation.
 java.lang.String getPopupMessage()
          Get the popup message.
 java.lang.String getSeverity()
          Get the severity string (NEEDS to be normalized).
 int getSeverityLevel()
          Get the severityLevel number where the violation occurred.
 java.lang.String getSource()
          Get the source of the violation.
 java.lang.String getSourceDetail()
          Get the source detail message.
 java.lang.String getType()
          Get the type.
 void setLine(int line)
          Set the line number in that the violation occurred.
 void setLine(java.lang.String line)
          Set the line number using a (possibly null) string.
 void setMessage(java.lang.String message)
          Set the message to used when displaying the violation.
 void setPopupMessage(java.lang.String popupMessage)
          Set the message to used when displaying the violation in a pop-up.
 void setSeverity(java.lang.String severity)
          Set the severity string (NEEDS to be normalized).
 void setSeverityLevel(int severityLevel)
          Set the severityLevel of the violation.
 void setSource(java.lang.String source)
          Set the source of the violation.
 void setType(java.lang.String type)
          Set the type of violation ('checkstyle', 'pmd' etc).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Violation

public Violation()
Method Detail

setType

public void setType(java.lang.String type)
Set the type of violation ('checkstyle', 'pmd' etc).

Parameters:
type - the value to use.

getType

public java.lang.String getType()
Get the type.

Returns:
the type;

setLine

public void setLine(int line)
Set the line number in that the violation occurred.

Parameters:
line - the value to use.

setLine

public void setLine(java.lang.String line)
Set the line number using a (possibly null) string. If the string does not parse set the line to 0.

Parameters:
line - the value to use.

getLine

public int getLine()
Get the line number where the violation occurred.

Returns:
the line number (0 if no line number).

setSeverityLevel

public void setSeverityLevel(int severityLevel)
Set the severityLevel of the violation.

Parameters:
severityLevel - the value to use.

getSeverityLevel

public int getSeverityLevel()
Get the severityLevel number where the violation occurred.

Returns:
the severityLevel number (0 if no severityLevel number).

setSeverity

public void setSeverity(java.lang.String severity)
Set the severity string (NEEDS to be normalized).

Parameters:
severity - the severity string.

getSeverity

public java.lang.String getSeverity()
Get the severity string (NEEDS to be normalized).

Returns:
the severity string.

setMessage

public void setMessage(java.lang.String message)
Set the message to used when displaying the violation.

Parameters:
message - the value to use.

getMessage

public java.lang.String getMessage()
Get the message to used when displaying the violation.

Returns:
the message.

setPopupMessage

public void setPopupMessage(java.lang.String popupMessage)
Set the message to used when displaying the violation in a pop-up. If this is null use the message attribute. This used for messages that contain markup like hyper links that are not to appear in popups.

Parameters:
popupMessage - the value to use.

getPopupMessage

public java.lang.String getPopupMessage()
Get the popup message.

Returns:
the popup message.

getSourceDetail

public java.lang.String getSourceDetail()
Get the source detail message.

Returns:
a detailed description for the source.

setSource

public void setSource(java.lang.String source)
Set the source of the violation. This is normally a language independent code for the violation.

Parameters:
source - the value to use.

getSource

public java.lang.String getSource()
Get the source of the violation.

Returns:
the source (from the last dot).

compareTo

public int compareTo(Violation other)
Compare to another violation.

Specified by:
compareTo in interface java.lang.Comparable<Violation>
Parameters:
other - the violation to compare to.
Returns:
0 if there are the same, otherwise base on the line number, type and hashcode.


Copyright © 2004-2012. All Rights Reserved.