net.sourceforge.pmd
public abstract class AbstractRule extends JavaParserVisitorAdapter implements Rule
Method Summary | |
---|---|
void | addExample(String example) |
void | addProperties(Properties properties) |
void | addProperty(String name, String value) |
void | addRuleChainVisit(String astNodeName) |
protected void | addViolation(Object data, SimpleNode node)
Adds a violation to the report.
|
protected void | addViolation(Object data, SimpleNode node, String embed)
Adds a violation to the report.
|
protected void | addViolation(Object data, Node node, Object[] args)
Adds a violation to the report.
|
protected void | addViolationWithMessage(Object data, SimpleNode node, String msg)
Adds a violation to the report.
|
void | apply(List acus, RuleContext ctx) |
protected static Map<String,PropertyDescriptor> | asFixedMap(PropertyDescriptor[] descriptors) |
protected static Map<String,PropertyDescriptor> | asFixedMap(PropertyDescriptor descriptor) |
boolean | equals(Object o)
Test if rules are equals. |
boolean[] | getBooleanProperties(PropertyDescriptor descriptor) |
boolean | getBooleanProperty(PropertyDescriptor descriptor) |
boolean | getBooleanProperty(String name) |
protected String | getDeclaringType(SimpleNode node)
Gets the Image of the first parent node of type ASTClassOrInterfaceDeclaration or null
|
String | getDescription() |
double[] | getDoubleProperties(PropertyDescriptor descriptor) |
double | getDoubleProperty(String name) |
double | getDoubleProperty(PropertyDescriptor descriptor) |
String | getExample()
Still used by the JDeveloper plugin
|
List<String> | getExamples() |
String | getExternalInfoUrl() |
int[] | getIntProperties(PropertyDescriptor descriptor) |
int | getIntProperty(String name) |
int | getIntProperty(PropertyDescriptor descriptor) |
String | getMessage() |
String | getName() |
int | getPriority() |
String | getPriorityName() |
Properties | getProperties() |
List<String> | getRuleChainVisits() |
String | getRuleSetName() |
String[] | getStringProperties(PropertyDescriptor descriptor) |
String | getStringProperty(String name) |
String | getStringProperty(PropertyDescriptor descriptor) |
Class[] | getTypeProperties(PropertyDescriptor descriptor) |
Class | getTypeProperty(PropertyDescriptor descriptor) |
int | hashCode()
Return a hash code to conform to equality. |
boolean | hasProperty(String name) |
static boolean | importsPackage(ASTCompilationUnit node, String packageName) |
boolean | include() |
static boolean | isQualifiedName(SimpleNode node) |
protected Map<String,PropertyDescriptor> | propertiesByName()
Return all the relevant properties for the receiver by
overriding in subclasses as necessary.
|
PropertyDescriptor | propertyDescriptorFor(String propertyName)
Return the indicated property descriptor or null if not found.
|
void | setBooleanProperty(String name, boolean flag) |
void | setDescription(String description) |
void | setExternalInfoUrl(String url) |
void | setInclude(boolean include) |
void | setMessage(String message) |
void | setName(String name) |
void | setPriority(int priority) |
void | setProperties(PropertyDescriptor descriptor, Object[] values) |
void | setProperty(PropertyDescriptor descriptor, Object value) |
void | setRuleSetName(String ruleSetName) |
void | setUsesDFA() |
void | setUsesTypeResolution() |
boolean | usesDFA() |
boolean | usesRuleChain() |
boolean | usesTypeResolution() |
protected void | visitAll(List acus, RuleContext ctx) |
Deprecated:
Deprecated:
Parameters: ctx the RuleContext node the node that produces the violation
Parameters: ctx the RuleContext node the node that produces the violation embed a variable to embed in the rule violation message
Parameters: ctx the RuleContext node the node that produces the violation, may be null, in which case all line and column info will be set to zero args objects to embed in the rule violation message
Parameters: ctx the RuleContext node the node that produces the violation msg specific message to put in the report
Deprecated: - use getBooleanProperty(PropertyDescriptor) instead
null
Parameters: node the node which will be searched
Deprecated: - use getDoubleProperty(PropertyDescriptor) instead
Deprecated: use getExamples(), since we now support multiple examples
Still used by the JDeveloper pluginDeprecated: - use getIntProperty(PropertyDescriptor) instead
Deprecated: - retrieve by name using get
Deprecated: - use getStringProperty(PropertyDescriptor) instead
Deprecated: - property values will be guaranteed available via default values
Returns: Map
Parameters: propertyName String
Returns: PropertyDescriptor
Deprecated: - use setProperty(PropertyDescriptor, Object) instead
Parameters: name flag