org.sonar.api.rules
Class Rule

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

public final class Rule
extends Object


Field Summary
static RulePriority DEFAULT_PRIORITY
          The default priority given to a rule if not explicitely set
 
Constructor Summary
Rule()
          Deprecated. since 2.3. Use the factory method create()
Rule(String pluginName, String key)
          Deprecated. since 2.3. Use the factory method create()
Rule(String name, String key, RulesCategory rulesCategory, String pluginName, String description)
          Deprecated. Use the factory method create()
Rule(String pluginKey, String key, String name, RulesCategory rulesCategory, RulePriority priority)
          Deprecated. since 2.3. Use the factory method create()
Rule(String name, String key, String configKey, RulesCategory rulesCategory, String pluginName, String description)
          Deprecated. since 2.3. Use the factory method create()
 
Method Summary
static Rule create()
           
static Rule create(String repositoryKey, String key, String name)
          Create with all required fields
 RuleParam createParameter()
           
 RuleParam createParameter(String key)
           
 boolean equals(Object obj)
           
 Cardinality getCardinality()
           
 Integer getCategoryId()
           
 String getConfigKey()
           
 String getDescription()
           
 Integer getId()
           
 String getKey()
           
 String getName()
           
 RuleParam getParam(String key)
           
 List<RuleParam> getParams()
           
 Rule getParent()
           
 String getPluginName()
           
 RulePriority getPriority()
           
 String getRepositoryKey()
           
 RulesCategory getRulesCategory()
           
 int hashCode()
           
 Boolean isEnabled()
           
 Rule setCardinality(Cardinality c)
           
 Rule setConfigKey(String configKey)
          Sets the configuration key
 Rule setDescription(String description)
          Sets the rule description
 Rule setEnabled(Boolean b)
          Do not call.
 void setId(Integer id)
          Deprecated. visibility should be decreased to protected or package
 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 setParent(Rule parent)
           
 Rule setPluginName(String pluginName)
          Sets the plugin name the rule belongs to
 Rule setPriority(RulePriority priority)
          Sets the rule priority.
 Rule setRepositoryKey(String s)
           
 Rule setRulesCategory(RulesCategory rulesCategory)
          Sets the rule category
 Rule setUniqueKey(String repositoryKey, String key)
           
 String toString()
           
 
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

@Deprecated
public Rule()
Deprecated. since 2.3. Use the factory method create()


Rule

@Deprecated
public Rule(String pluginName,
                       String key)
Deprecated. since 2.3. Use the factory method create()

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

@Deprecated
public Rule(String pluginKey,
                       String key,
                       String name,
                       RulesCategory rulesCategory,
                       RulePriority priority)
Deprecated. since 2.3. Use the factory method create()

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. Use the factory method create()


Rule

@Deprecated
public Rule(String name,
                       String key,
                       String configKey,
                       RulesCategory rulesCategory,
                       String pluginName,
                       String description)
Deprecated. since 2.3. Use the factory method create()

Method Detail

getId

public Integer getId()

setId

@Deprecated
public void setId(Integer id)
Deprecated. visibility should be decreased to protected or package


getName

public String getName()

setName

public 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()

isEnabled

public Boolean isEnabled()

setEnabled

public Rule setEnabled(Boolean b)
Do not call. Used only by sonar.


setDescription

public Rule setDescription(String description)
Sets the rule description


getParams

public List<RuleParam> getParams()

getParam

public RuleParam getParam(String key)

setParams

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


createParameter

public RuleParam createParameter()

createParameter

public RuleParam createParameter(String key)

getCategoryId

public Integer getCategoryId()

getPriority

public RulePriority getPriority()

setPriority

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


getRepositoryKey

public String getRepositoryKey()

setRepositoryKey

public Rule setRepositoryKey(String s)

setUniqueKey

public Rule setUniqueKey(String repositoryKey,
                         String key)

getCardinality

public Cardinality getCardinality()

setCardinality

public Rule setCardinality(Cardinality c)

getParent

public Rule getParent()

setParent

public Rule setParent(Rule parent)

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

create

public static Rule create()

create

public static Rule create(String repositoryKey,
                          String key,
                          String name)
Create with all required fields



Copyright © 2009-2010 SonarSource. All Rights Reserved.