Class Violation
java.lang.Object
com.puppycrawl.tools.checkstyle.api.Violation
- All Implemented Interfaces:
- Comparable<Violation>
Represents a violation that can be localised. The translations come from
 message.properties files. The underlying implementation uses
 java.text.MessageFormat.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final Object[]Arguments for MessageFormat.private final StringName of the resource bundle to get violations from.private final intThe column char index.private final intThe column number.private final StringA custom violation overriding the default violation from the bundle.private static final SeverityLevelThe default severity level if one is not specified.private final StringKey for the violation format.private final intThe line number.private final StringThe id of the module generating the violation.private final SeverityLevelThe severity level.private final Class<?>Class of the source for this Violation.private final intThe token type constant.
- 
Constructor SummaryConstructorsConstructorDescriptionViolation(int lineNo, int columnNo, int columnCharIndex, int tokenType, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, String customMessage) Creates a newViolationinstance.Violation(int lineNo, int columnNo, int tokenType, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, String customMessage) Creates a newViolationinstance.Violation(int lineNo, int columnNo, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, String customMessage) Creates a newViolationinstance.Violation(int lineNo, int columnNo, String bundle, String key, Object[] args, String moduleId, Class<?> sourceClass, String customMessage) Creates a newViolationinstance.Violation(int lineNo, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, String customMessage) Creates a newViolationinstance.Violation(int lineNo, String bundle, String key, Object[] args, String moduleId, Class<?> sourceClass, String customMessage) Creates a newViolationinstance.
- 
Method SummaryModifier and TypeMethodDescriptionintbooleanIndicates whether some other object is "equal to" this one.intGets the column char index.intGets the column number.getKey()Returns the violation key to locate the translation, can also be used in IDE plugins to map audit event violations to corrective actions.intGets the line number.Returns id of module.Gets the severity level.Gets the name of the source for this Violation.intGets the token type.Gets the translated violation.inthashCode()
- 
Field Details- 
DEFAULT_SEVERITYThe default severity level if one is not specified.
- 
lineNoThe line number.
- 
columnNoThe column number.
- 
columnCharIndexThe column char index.
- 
tokenTypeThe token type constant. SeeTokenTypes.
- 
severityLevelThe severity level.
- 
moduleIdThe id of the module generating the violation.
- 
keyKey for the violation format.
- 
argsArguments for MessageFormat.
- 
bundleName of the resource bundle to get violations from.
- 
sourceClassClass of the source for this Violation.
- 
customMessageA custom violation overriding the default violation from the bundle.
 
- 
- 
Constructor Details- 
Violationpublic Violation(int lineNo, int columnNo, int columnCharIndex, int tokenType, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, @Nullable String customMessage) Creates a newViolationinstance.- Parameters:
- lineNo- line number associated with the violation
- columnNo- column number associated with the violation
- columnCharIndex- column char index associated with the violation
- tokenType- token type of the event associated with violation. See- TokenTypes
- bundle- resource bundle name
- key- the key to locate the translation
- args- arguments for the translation
- severityLevel- severity level for the violation
- moduleId- the id of the module the violation is associated with
- sourceClass- the Class that is the source of the violation
- customMessage- optional custom violation overriding the default
 
- 
Violationpublic Violation(int lineNo, int columnNo, int tokenType, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, @Nullable String customMessage) Creates a newViolationinstance.- Parameters:
- lineNo- line number associated with the violation
- columnNo- column number associated with the violation
- tokenType- token type of the event associated with violation. See- TokenTypes
- bundle- resource bundle name
- key- the key to locate the translation
- args- arguments for the translation
- severityLevel- severity level for the violation
- moduleId- the id of the module the violation is associated with
- sourceClass- the Class that is the source of the violation
- customMessage- optional custom violation overriding the default
 
- 
Violationpublic Violation(int lineNo, int columnNo, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, @Nullable String customMessage) Creates a newViolationinstance.- Parameters:
- lineNo- line number associated with the violation
- columnNo- column number associated with the violation
- bundle- resource bundle name
- key- the key to locate the translation
- args- arguments for the translation
- severityLevel- severity level for the violation
- moduleId- the id of the module the violation is associated with
- sourceClass- the Class that is the source of the violation
- customMessage- optional custom violation overriding the default
 
- 
Violationpublic Violation(int lineNo, int columnNo, String bundle, String key, Object[] args, String moduleId, Class<?> sourceClass, @Nullable String customMessage) Creates a newViolationinstance.- Parameters:
- lineNo- line number associated with the violation
- columnNo- column number associated with the violation
- bundle- resource bundle name
- key- the key to locate the translation
- args- arguments for the translation
- moduleId- the id of the module the violation is associated with
- sourceClass- the Class that is the source of the violation
- customMessage- optional custom violation overriding the default
 
- 
Violationpublic Violation(int lineNo, String bundle, String key, Object[] args, SeverityLevel severityLevel, String moduleId, Class<?> sourceClass, @Nullable String customMessage) Creates a newViolationinstance.- Parameters:
- lineNo- line number associated with the violation
- bundle- resource bundle name
- key- the key to locate the translation
- args- arguments for the translation
- severityLevel- severity level for the violation
- moduleId- the id of the module the violation is associated with
- sourceClass- the source class for the violation
- customMessage- optional custom violation overriding the default
 
- 
Violationpublic Violation(int lineNo, String bundle, String key, Object[] args, String moduleId, Class<?> sourceClass, @Nullable String customMessage) Creates a newViolationinstance. The column number defaults to 0.- Parameters:
- lineNo- line number associated with the violation
- bundle- name of a resource bundle that contains audit event violations
- key- the key to locate the translation
- args- arguments for the translation
- moduleId- the id of the module the violation is associated with
- sourceClass- the name of the source for the violation
- customMessage- optional custom violation overriding the default
 
 
- 
- 
Method Details- 
getLineNoGets the line number.- Returns:
- the line number
 
- 
getColumnNoGets the column number.- Returns:
- the column number
 
- 
getColumnCharIndexGets the column char index.- Returns:
- the column char index
 
- 
getTokenTypeGets the token type.- Returns:
- the token type
 
- 
getSeverityLevelGets the severity level.- Returns:
- the severity level
 
- 
getModuleIdReturns id of module.- Returns:
- the module identifier.
 
- 
getKeyReturns the violation key to locate the translation, can also be used in IDE plugins to map audit event violations to corrective actions.- Returns:
- the violation key
 
- 
getSourceNameGets the name of the source for this Violation.- Returns:
- the name of the source for this Violation
 
- 
equalsIndicates whether some other object is "equal to" this one. Suppression on enumeration is needed so code stays consistent.
- 
hashCode
- 
compareTo- Specified by:
- compareToin interface- Comparable<Violation>
 
- 
getViolationGets the translated violation.- Returns:
- the translated violation
 
 
-