Package org.sonar.api.rules
Class Rule
- java.lang.Object
-
- org.sonar.api.rules.Rule
-
public class Rule extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static RulePriorityDEFAULT_PRIORITYThe default priority given to a rule if not explicitly setstatic java.lang.StringSTATUS_BETAstatic java.lang.StringSTATUS_DEPRECATEDstatic java.lang.StringSTATUS_READYstatic java.lang.StringSTATUS_REMOVEDFor internal use only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Rulecreate()static Rulecreate(java.lang.String repositoryKey, java.lang.String key)Create with all required fieldsstatic Rulecreate(java.lang.String repositoryKey, java.lang.String key, java.lang.String name)Create with all required fieldsRuleParamcreateParameter()RuleParamcreateParameter(java.lang.String key)booleanequals(java.lang.Object obj)org.sonar.check.CardinalitygetCardinality()Deprecated.since 4.4, useisTemplate()java.lang.IntegergetCharacteristicId()Deprecated.since 4.4, usegetCharacteristicKey()java.lang.StringgetCharacteristicKey()Deprecated.in 5.5.java.lang.StringgetConfigKey()java.util.DategetCreatedAt()java.lang.IntegergetDefaultCharacteristicId()Deprecated.since 4.4, usegetDefaultCharacteristicKey()java.lang.StringgetDefaultCharacteristicKey()Deprecated.in 5.5.java.lang.StringgetDefaultSubCharacteristicKey()Deprecated.in 5.5.java.lang.StringgetDescription()java.lang.IntegergetId()java.lang.StringgetKey()java.lang.StringgetLanguage()java.lang.StringgetName()RuleParamgetParam(java.lang.String key)java.util.List<RuleParam>getParams()RulegetParent()Deprecated.since 4.4, usegetTemplate()java.lang.StringgetRepositoryKey()RulePrioritygetSeverity()java.lang.StringgetStatus()java.lang.StringgetSubCharacteristicKey()Deprecated.in 5.5.java.lang.String[]getSystemTags()For internal usejava.lang.String[]getTags()For definition of rule onlyRulegetTemplate()java.util.DategetUpdatedAt()inthashCode()java.lang.BooleanisEnabled()booleanisTemplate()RuleKeyruleKey()RulesetCardinality(org.sonar.check.Cardinality c)Deprecated.since 4.4, usesetIsTemplate(boolean)RulesetCharacteristicId(java.lang.Integer characteristicId)Deprecated.since 4.4, usesetCharacteristicKey(String)RulesetCharacteristicKey(java.lang.String characteristicKey)Deprecated.in 5.5.RulesetConfigKey(java.lang.String configKey)Sets the configuration keyRulesetCreatedAt(java.util.Date d)RulesetDefaultCharacteristicId(java.lang.Integer defaultCharacteristicId)Deprecated.since 4.4, usesetDefaultCharacteristicKey(String)RulesetDefaultCharacteristicKey(java.lang.String defaultCharacteristicKey)Deprecated.in 5.5.RulesetDefaultSubCharacteristicKey(java.lang.String defaultSubCharacteristicKey)Deprecated.in 5.5.RulesetDescription(java.lang.String description)Sets the rule descriptionvoidsetId(java.lang.Integer id)Deprecated.since 2.3.RulesetIsTemplate(boolean isTemplate)RulesetKey(java.lang.String key)Sets the rule keyRulesetLanguage(java.lang.String language)For internal use only.RulesetName(java.lang.String name)Sets the rule nameRulesetParams(java.util.List<RuleParam> params)Sets the rule parametersRulesetParent(Rule parent)Deprecated.since 4.4, usesetTemplate(Rule)}RulesetRepositoryKey(java.lang.String s)RulesetSeverity(RulePriority severity)RulesetStatus(java.lang.String status)RulesetSubCharacteristicKey(java.lang.String subCharacteristicKey)Deprecated.in 5.5.RulesetSystemTags(java.lang.String[] tags)RulesetTags(java.lang.String[] tags)For definition of rule onlyRulesetTemplate(Rule template)RulesetUniqueKey(java.lang.String repositoryKey, java.lang.String key)RulesetUpdatedAt(java.util.Date updatedAt)java.lang.StringtoString()
-
-
-
Field Detail
-
STATUS_BETA
public static final java.lang.String STATUS_BETA
- Since:
- 3.6
- See Also:
- Constant Field Values
-
STATUS_DEPRECATED
public static final java.lang.String STATUS_DEPRECATED
- Since:
- 3.6
- See Also:
- Constant Field Values
-
STATUS_READY
public static final java.lang.String STATUS_READY
- Since:
- 3.6
- See Also:
- Constant Field Values
-
STATUS_REMOVED
public static final java.lang.String STATUS_REMOVED
For internal use only.- Since:
- 3.6
- See Also:
- Constant Field Values
-
DEFAULT_PRIORITY
public static final RulePriority DEFAULT_PRIORITY
The default priority given to a rule if not explicitly set
-
-
Constructor Detail
-
Rule
@Deprecated public Rule()
Deprecated.since 2.3. Use the factory methodcreate()
-
Rule
@Deprecated public Rule(java.lang.String pluginName, java.lang.String key)Deprecated.since 2.3. Use the factory methodcreate()Creates rule with minimum set of info- Parameters:
pluginName- the plugin name indicates which plugin the rule belongs tokey- the key should be unique within a plugin, but it is even more careful for the time being that it is unique across the application
-
-
Method Detail
-
getId
public java.lang.Integer getId()
-
setId
@Deprecated public void setId(java.lang.Integer id)
Deprecated.since 2.3. visibility should be decreased to protected or package
-
getName
public java.lang.String getName()
-
setName
public Rule setName(java.lang.String name)
Sets the rule name
-
getKey
public java.lang.String getKey()
-
setKey
public Rule setKey(java.lang.String key)
Sets the rule key
-
getConfigKey
public java.lang.String getConfigKey()
-
setConfigKey
public Rule setConfigKey(java.lang.String configKey)
Sets the configuration key
-
getDescription
public java.lang.String getDescription()
-
setDescription
public Rule setDescription(java.lang.String description)
Sets the rule description
-
isEnabled
public java.lang.Boolean isEnabled()
-
getParams
public java.util.List<RuleParam> getParams()
-
getParam
public RuleParam getParam(java.lang.String key)
-
createParameter
public RuleParam createParameter()
-
createParameter
public RuleParam createParameter(java.lang.String key)
-
getSeverity
public RulePriority getSeverity()
- Since:
- 2.5
-
setSeverity
public Rule setSeverity(RulePriority severity)
- Parameters:
severity- severity to set, if null, uses the default priority.- Since:
- 2.5
-
getRepositoryKey
public java.lang.String getRepositoryKey()
-
setRepositoryKey
public Rule setRepositoryKey(java.lang.String s)
-
setUniqueKey
public Rule setUniqueKey(java.lang.String repositoryKey, java.lang.String key)
-
isTemplate
public boolean isTemplate()
- Since:
- 4.4
-
setIsTemplate
public Rule setIsTemplate(boolean isTemplate)
- Since:
- 4.4
-
getCardinality
@Deprecated public org.sonar.check.Cardinality getCardinality()
Deprecated.since 4.4, useisTemplate()
-
setCardinality
@Deprecated public Rule setCardinality(org.sonar.check.Cardinality c)
Deprecated.since 4.4, usesetIsTemplate(boolean)
-
getParent
@Deprecated public Rule getParent()
Deprecated.since 4.4, usegetTemplate()
-
setParent
@Deprecated public Rule setParent(Rule parent)
Deprecated.since 4.4, usesetTemplate(Rule)}
-
getTemplate
public Rule getTemplate()
- Since:
- 4.4
-
getStatus
public java.lang.String getStatus()
- Since:
- 3.6
-
setStatus
public Rule setStatus(java.lang.String status)
- Since:
- 3.6
-
getCreatedAt
public java.util.Date getCreatedAt()
- Since:
- 3.6
-
setCreatedAt
public Rule setCreatedAt(java.util.Date d)
- Since:
- 3.6
-
getUpdatedAt
public java.util.Date getUpdatedAt()
- Since:
- 3.6
-
setUpdatedAt
public Rule setUpdatedAt(java.util.Date updatedAt)
- Since:
- 3.6
-
getLanguage
public java.lang.String getLanguage()
- Since:
- 3.6
-
setLanguage
public Rule setLanguage(java.lang.String language)
For internal use only.- Since:
- 3.6
-
getTags
public java.lang.String[] getTags()
For definition of rule only
-
setTags
public Rule setTags(java.lang.String[] tags)
For definition of rule only
-
getSystemTags
public java.lang.String[] getSystemTags()
For internal use
-
setSystemTags
public Rule setSystemTags(java.lang.String[] tags)
-
getCharacteristicId
@CheckForNull @Deprecated public java.lang.Integer getCharacteristicId()
Deprecated.since 4.4, usegetCharacteristicKey()For internal use only.- Since:
- 4.3
-
setCharacteristicId
@Deprecated public Rule setCharacteristicId(@Nullable java.lang.Integer characteristicId)
Deprecated.since 4.4, usesetCharacteristicKey(String)For internal use only.- Since:
- 4.3
-
getDefaultCharacteristicId
@CheckForNull @Deprecated public java.lang.Integer getDefaultCharacteristicId()
Deprecated.since 4.4, usegetDefaultCharacteristicKey()For internal use only.- Since:
- 4.3
-
setDefaultCharacteristicId
@Deprecated public Rule setDefaultCharacteristicId(@Nullable java.lang.Integer defaultCharacteristicId)
Deprecated.since 4.4, usesetDefaultCharacteristicKey(String)For internal use only.- Since:
- 4.3
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
create
public static Rule create()
-
create
public static Rule create(java.lang.String repositoryKey, java.lang.String key, java.lang.String name)
Create with all required fields
-
create
public static Rule create(java.lang.String repositoryKey, java.lang.String key)
Create with all required fields- Since:
- 2.10
-
ruleKey
public RuleKey ruleKey()
- Since:
- 3.6
-
getDefaultCharacteristicKey
@CheckForNull @Deprecated public java.lang.String getDefaultCharacteristicKey()
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
setDefaultCharacteristicKey
@Deprecated public Rule setDefaultCharacteristicKey(@Nullable java.lang.String defaultCharacteristicKey)
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
getDefaultSubCharacteristicKey
@CheckForNull @Deprecated public java.lang.String getDefaultSubCharacteristicKey()
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
setDefaultSubCharacteristicKey
@Deprecated public Rule setDefaultSubCharacteristicKey(@Nullable java.lang.String defaultSubCharacteristicKey)
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
getCharacteristicKey
@CheckForNull @Deprecated public java.lang.String getCharacteristicKey()
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
setCharacteristicKey
@Deprecated public Rule setCharacteristicKey(@Nullable java.lang.String characteristicKey)
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
getSubCharacteristicKey
@CheckForNull @Deprecated public java.lang.String getSubCharacteristicKey()
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
setSubCharacteristicKey
@Deprecated public Rule setSubCharacteristicKey(@Nullable java.lang.String subCharacteristicKey)
Deprecated.in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model.- Since:
- 4.4
-
-