|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.pmd.ast.JavaParserVisitorAdapter
net.sourceforge.pmd.AbstractRule
public abstract class AbstractRule
Field Summary |
---|
Fields inherited from interface net.sourceforge.pmd.Rule |
---|
LOWEST_PRIORITY, PRIORITIES |
Constructor Summary | |
---|---|
AbstractRule()
|
Method Summary | |
---|---|
void |
addExample(java.lang.String example)
|
void |
addProperties(java.util.Properties properties)
Deprecated. |
void |
addProperty(java.lang.String name,
java.lang.String value)
Deprecated. |
void |
addRuleChainVisit(java.lang.String astNodeName)
|
protected void |
addViolation(java.lang.Object data,
Node node,
java.lang.Object[] args)
Adds a violation to the report. |
protected void |
addViolation(java.lang.Object data,
SimpleNode node)
Adds a violation to the report. |
protected void |
addViolation(java.lang.Object data,
SimpleNode node,
java.lang.String embed)
Adds a violation to the report. |
protected void |
addViolationWithMessage(java.lang.Object data,
SimpleNode node,
java.lang.String msg)
Adds a violation to the report. |
void |
apply(java.util.List acus,
RuleContext ctx)
|
protected static java.util.Map<java.lang.String,PropertyDescriptor> |
asFixedMap(PropertyDescriptor descriptor)
|
protected static java.util.Map<java.lang.String,PropertyDescriptor> |
asFixedMap(PropertyDescriptor[] descriptors)
|
boolean |
equals(java.lang.Object o)
Test if rules are equals. |
boolean[] |
getBooleanProperties(PropertyDescriptor descriptor)
|
boolean |
getBooleanProperty(PropertyDescriptor descriptor)
|
boolean |
getBooleanProperty(java.lang.String name)
Deprecated. - use getBooleanProperty(PropertyDescriptor) instead |
protected java.lang.String |
getDeclaringType(SimpleNode node)
Gets the Image of the first parent node of type ASTClassOrInterfaceDeclaration or null |
java.lang.String |
getDescription()
|
double[] |
getDoubleProperties(PropertyDescriptor descriptor)
|
double |
getDoubleProperty(PropertyDescriptor descriptor)
|
double |
getDoubleProperty(java.lang.String name)
Deprecated. - use getDoubleProperty(PropertyDescriptor) instead |
java.lang.String |
getExample()
Deprecated. use getExamples(), since we now support multiple examples |
java.util.List<java.lang.String> |
getExamples()
|
java.lang.String |
getExternalInfoUrl()
|
int[] |
getIntProperties(PropertyDescriptor descriptor)
|
int |
getIntProperty(PropertyDescriptor descriptor)
|
int |
getIntProperty(java.lang.String name)
Deprecated. - use getIntProperty(PropertyDescriptor) instead |
java.lang.String |
getMessage()
|
java.lang.String |
getName()
|
int |
getPriority()
|
java.lang.String |
getPriorityName()
|
java.util.Properties |
getProperties()
Deprecated. - retrieve by name using get |
java.util.List<java.lang.String> |
getRuleChainVisits()
|
java.lang.String |
getRuleSetName()
|
java.lang.String[] |
getStringProperties(PropertyDescriptor descriptor)
|
java.lang.String |
getStringProperty(PropertyDescriptor descriptor)
|
java.lang.String |
getStringProperty(java.lang.String name)
Deprecated. - use getStringProperty(PropertyDescriptor) instead |
java.lang.Class[] |
getTypeProperties(PropertyDescriptor descriptor)
|
java.lang.Class |
getTypeProperty(PropertyDescriptor descriptor)
|
int |
hashCode()
Return a hash code to conform to equality. |
boolean |
hasProperty(java.lang.String name)
Deprecated. - property values will be guaranteed available via default values |
static boolean |
importsPackage(ASTCompilationUnit node,
java.lang.String packageName)
|
boolean |
include()
|
static boolean |
isQualifiedName(SimpleNode node)
|
protected java.util.Map<java.lang.String,PropertyDescriptor> |
propertiesByName()
Return all the relevant properties for the receiver by overriding in subclasses as necessary. |
PropertyDescriptor |
propertyDescriptorFor(java.lang.String propertyName)
Return the indicated property descriptor or null if not found. |
void |
setBooleanProperty(java.lang.String name,
boolean flag)
Deprecated. - use setProperty(PropertyDescriptor, Object) instead |
void |
setDescription(java.lang.String description)
|
void |
setExternalInfoUrl(java.lang.String url)
|
void |
setInclude(boolean include)
|
void |
setMessage(java.lang.String message)
|
void |
setName(java.lang.String name)
|
void |
setPriority(int priority)
|
void |
setProperties(PropertyDescriptor descriptor,
java.lang.Object[] values)
|
void |
setProperty(PropertyDescriptor descriptor,
java.lang.Object value)
|
void |
setRuleSetName(java.lang.String ruleSetName)
|
void |
setUsesDFA()
|
void |
setUsesTypeResolution()
|
boolean |
usesDFA()
|
boolean |
usesRuleChain()
|
boolean |
usesTypeResolution()
|
protected void |
visitAll(java.util.List acus,
RuleContext ctx)
|
Methods inherited from class net.sourceforge.pmd.ast.JavaParserVisitorAdapter |
---|
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractRule()
Method Detail |
---|
protected static java.util.Map<java.lang.String,PropertyDescriptor> asFixedMap(PropertyDescriptor[] descriptors)
protected static java.util.Map<java.lang.String,PropertyDescriptor> asFixedMap(PropertyDescriptor descriptor)
public java.lang.String getRuleSetName()
getRuleSetName
in interface Rule
public void setRuleSetName(java.lang.String ruleSetName)
setRuleSetName
in interface Rule
public java.lang.String getDescription()
getDescription
in interface Rule
public void setDescription(java.lang.String description)
setDescription
in interface Rule
public java.util.List<java.lang.String> getExamples()
getExamples
in interface Rule
public java.lang.String getExample()
getExample
in interface Rule
public void addExample(java.lang.String example)
addExample
in interface Rule
public boolean hasProperty(java.lang.String name)
hasProperty
in interface Rule
public void addProperty(java.lang.String name, java.lang.String value)
addProperty
in interface Rule
public void addProperties(java.util.Properties properties)
addProperties
in interface Rule
public double[] getDoubleProperties(PropertyDescriptor descriptor)
public double getDoubleProperty(java.lang.String name)
getDoubleProperty
in interface Rule
public double getDoubleProperty(PropertyDescriptor descriptor)
public int[] getIntProperties(PropertyDescriptor descriptor)
public int getIntProperty(java.lang.String name)
getIntProperty
in interface Rule
public int getIntProperty(PropertyDescriptor descriptor)
public java.lang.Class[] getTypeProperties(PropertyDescriptor descriptor)
public java.lang.Class getTypeProperty(PropertyDescriptor descriptor)
public boolean[] getBooleanProperties(PropertyDescriptor descriptor)
public boolean getBooleanProperty(PropertyDescriptor descriptor)
public boolean getBooleanProperty(java.lang.String name)
getBooleanProperty
in interface Rule
public void setBooleanProperty(java.lang.String name, boolean flag)
name
- flag
- public java.lang.String[] getStringProperties(PropertyDescriptor descriptor)
public java.lang.String getStringProperty(java.lang.String name)
getStringProperty
in interface Rule
public java.lang.String getStringProperty(PropertyDescriptor descriptor)
public void setProperty(PropertyDescriptor descriptor, java.lang.Object value)
public void setProperties(PropertyDescriptor descriptor, java.lang.Object[] values)
public java.lang.String getName()
getName
in interface Rule
public void setName(java.lang.String name)
setName
in interface Rule
public java.lang.String getMessage()
getMessage
in interface Rule
public void setMessage(java.lang.String message)
setMessage
in interface Rule
public java.lang.String getExternalInfoUrl()
getExternalInfoUrl
in interface Rule
public void setExternalInfoUrl(java.lang.String url)
setExternalInfoUrl
in interface Rule
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void apply(java.util.List acus, RuleContext ctx)
apply
in interface Rule
public java.util.Properties getProperties()
getProperties
in interface Rule
public boolean include()
include
in interface Rule
public void setInclude(boolean include)
setInclude
in interface Rule
public int getPriority()
getPriority
in interface Rule
public java.lang.String getPriorityName()
getPriorityName
in interface Rule
public void setPriority(int priority)
setPriority
in interface Rule
public void setUsesDFA()
setUsesDFA
in interface Rule
public boolean usesDFA()
usesDFA
in interface Rule
public void setUsesTypeResolution()
setUsesTypeResolution
in interface Rule
public boolean usesTypeResolution()
usesTypeResolution
in interface Rule
protected void visitAll(java.util.List acus, RuleContext ctx)
protected final void addViolation(java.lang.Object data, SimpleNode node)
ctx
- the RuleContextnode
- the node that produces the violationprotected final void addViolationWithMessage(java.lang.Object data, SimpleNode node, java.lang.String msg)
ctx
- the RuleContextnode
- the node that produces the violationmsg
- specific message to put in the reportprotected final void addViolation(java.lang.Object data, SimpleNode node, java.lang.String embed)
ctx
- the RuleContextnode
- the node that produces the violationembed
- a variable to embed in the rule violation messageprotected final void addViolation(java.lang.Object data, Node node, java.lang.Object[] args)
ctx
- the RuleContextnode
- the node that produces the violation, may be null, in which case all line and column info will be set to zeroargs
- objects to embed in the rule violation messageprotected final java.lang.String getDeclaringType(SimpleNode node)
null
node
- the node which will be searchedpublic static boolean isQualifiedName(SimpleNode node)
public static boolean importsPackage(ASTCompilationUnit node, java.lang.String packageName)
protected java.util.Map<java.lang.String,PropertyDescriptor> propertiesByName()
public PropertyDescriptor propertyDescriptorFor(java.lang.String propertyName)
propertyDescriptorFor
in interface Rule
propertyName
- String
public boolean usesRuleChain()
usesRuleChain
in interface Rule
public java.util.List<java.lang.String> getRuleChainVisits()
getRuleChainVisits
in interface Rule
public void addRuleChainVisit(java.lang.String astNodeName)
addRuleChainVisit
in interface Rule
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |