Package net.sourceforge.pmd.lang.rule
Enum RulePriority
- java.lang.Object
-
- java.lang.Enum<RulePriority>
-
- net.sourceforge.pmd.lang.rule.RulePriority
-
- All Implemented Interfaces:
Serializable
,Comparable<RulePriority>
public enum RulePriority extends Enum<RulePriority>
These are the possible Rule priority values. For backward compatibility, priorities range in value from 1 to 5, with 5 being the lowest priority. This means the ordinal value of the Enum should be avoided in favor ofgetPriority()
andvalueOf(int)
- See Also:
- How to define rules priority
-
-
Enum Constant Summary
Enum Constants Enum Constant Description HIGH
High: Change absolutely required.LOW
Low: Change highly optional.MEDIUM
Medium: Change recommended.MEDIUM_HIGH
Medium to high: Change highly recommended.MEDIUM_LOW
Medium to low: Change optional.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Get the descriptive name of this priority.int
getPriority()
Get the priority value as a number.String
toString()
Returns the descriptive name of the priority.static RulePriority
valueOf(int priority)
Get the priority which corresponds to the given number as returned bygetPriority()
.static RulePriority
valueOf(String name)
Returns the enum constant of this type with the specified name.static RulePriority
valueOfNullable(int priority)
Returns the priority which corresponds to the given number as returned bygetPriority()
.static RulePriority
valueOfNullable(String priority)
Returns the priority which corresponds to the given number as returned bygetPriority()
.static RulePriority[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HIGH
public static final RulePriority HIGH
High: Change absolutely required. Behavior is critically broken/buggy
-
MEDIUM_HIGH
public static final RulePriority MEDIUM_HIGH
Medium to high: Change highly recommended. Behavior is quite likely to be broken/buggy.
-
MEDIUM
public static final RulePriority MEDIUM
Medium: Change recommended. Behavior is confusing, perhaps buggy, and/or against standards/best practices.
-
MEDIUM_LOW
public static final RulePriority MEDIUM_LOW
Medium to low: Change optional. Behavior is not likely to be buggy, but more just flies in the face of standards/style/good taste.
-
LOW
public static final RulePriority LOW
Low: Change highly optional. Nice to have, such as a consistent naming policy for package/class/fields...
-
-
Method Detail
-
values
public static RulePriority[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RulePriority c : RulePriority.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RulePriority valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getPriority
public int getPriority()
Get the priority value as a number. This is the value to be used in the externalized form of a priority (e.g. in RuleSet XML).- Returns:
- The
int
value of the priority.
-
getName
public String getName()
Get the descriptive name of this priority.- Returns:
- The descriptive name.
-
toString
public String toString()
Returns the descriptive name of the priority.- Overrides:
toString
in classEnum<RulePriority>
- Returns:
- descriptive name of the priority
- See Also:
getName()
-
valueOf
public static RulePriority valueOf(int priority)
Get the priority which corresponds to the given number as returned bygetPriority()
. If the number is an invalid value, thenLOW
will be returned.- Parameters:
priority
- The numeric priority value.- Returns:
- The priority.
-
valueOfNullable
public static RulePriority valueOfNullable(int priority)
Returns the priority which corresponds to the given number as returned bygetPriority()
. If the number is an invalid value, then null will be returned.- Parameters:
priority
- The numeric priority value.
-
valueOfNullable
public static RulePriority valueOfNullable(String priority)
Returns the priority which corresponds to the given number as returned bygetPriority()
. If the number is an invalid value, then null will be returned.- Parameters:
priority
- The numeric priority value.
-
-