org.sonar.api.rules
Class Rule

java.lang.Object
  extended by org.sonar.api.database.BaseIdentifiable
      extended by org.sonar.api.rules.Rule

public class Rule
extends BaseIdentifiable

A class to map rules with Hibernate model


Field Summary
static RulePriority DEFAULT_PRIORITY
          The default priority given to a rule if not explicitely set
 
Constructor Summary
Rule()
           
Rule(String pluginName, String key)
          Creates rule with minimum set of info
Rule(String name, String key, RulesCategory rulesCategory, String pluginName, String description)
          Deprecated. 
Rule(String pluginKey, String key, String name, RulesCategory rulesCategory, RulePriority priority)
          Creates a fully qualified rule
Rule(String name, String key, String configKey, RulesCategory rulesCategory, String pluginName, String description)
          Deprecated. 
 
Method Summary
 boolean equals(Object obj)
           
 Integer getCategoryId()
           
 String getConfigKey()
           
 String getDescription()
           
 String getKey()
           
 String getName()
           
 List<RuleParam> getParams()
           
 String getPluginName()
           
 RulePriority getPriority()
           
 RulesCategory getRulesCategory()
           
 int hashCode()
           
 Rule setConfigKey(String configKey)
          Sets the configuration key
 Rule setDescription(String description)
          Sets the rule description
 Rule setKey(String key)
          Sets the rule key
 Rule setName(String name)
          Sets the rule name
 Rule setParams(List<RuleParam> params)
          Sets the rule parameters
 Rule setPluginName(String pluginName)
          Sets the plugin name the rule belongs to
 Rule setPriority(RulePriority priority)
          Sets the rule priority.
 Rule setRulesCategory(RulesCategory rulesCategory)
          Sets the rule category
 String toString()
           
 
Methods inherited from class org.sonar.api.database.BaseIdentifiable
getId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PRIORITY

public static final RulePriority DEFAULT_PRIORITY
The default priority given to a rule if not explicitely set

Constructor Detail

Rule

public Rule()

Rule

public Rule(String pluginName,
            String key)
Creates rule with minimum set of info

Parameters:
pluginName - the plugin name indicates which plugin the rule belongs to
key - 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

Rule

public Rule(String pluginKey,
            String key,
            String name,
            RulesCategory rulesCategory,
            RulePriority priority)
Creates a fully qualified rule

Parameters:
pluginKey - the plugin the rule belongs to
key - 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
name - the name displayed in the UI
rulesCategory - the ISO category the rule belongs to
priority - this is the priority associated to the rule

Rule

@Deprecated
public Rule(String name,
                       String key,
                       RulesCategory rulesCategory,
                       String pluginName,
                       String description)
Deprecated. 


Rule

@Deprecated
public Rule(String name,
                       String key,
                       String configKey,
                       RulesCategory rulesCategory,
                       String pluginName,
                       String description)
Deprecated. 

Method Detail

getName

public String getName()

setName

public final Rule setName(String name)
Sets the rule name


getKey

public String getKey()

setKey

public Rule setKey(String key)
Sets the rule key


getRulesCategory

public RulesCategory getRulesCategory()
Returns:
the rule category

setRulesCategory

public Rule setRulesCategory(RulesCategory rulesCategory)
Sets the rule category


getPluginName

public String getPluginName()

setPluginName

public Rule setPluginName(String pluginName)
Sets the plugin name the rule belongs to


getConfigKey

public String getConfigKey()

setConfigKey

public Rule setConfigKey(String configKey)
Sets the configuration key


getDescription

public String getDescription()

setDescription

public Rule setDescription(String description)
Sets the rule description


getParams

public List<RuleParam> getParams()

setParams

public Rule setParams(List<RuleParam> params)
Sets the rule parameters


getCategoryId

public Integer getCategoryId()

getPriority

public RulePriority getPriority()

setPriority

public Rule setPriority(RulePriority priority)
Sets the rule priority. If null, uses the default priority


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 SonarSource SA. All Rights Reserved.