Class LawOfDemeterRule
- java.lang.Object
-
- net.sourceforge.pmd.properties.AbstractPropertySource
-
- net.sourceforge.pmd.lang.rule.AbstractRule
-
- net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
-
- net.sourceforge.pmd.lang.java.rule.design.LawOfDemeterRule
-
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.AstVisitor
,JavaVisitor
,net.sourceforge.pmd.lang.rule.Rule
,net.sourceforge.pmd.properties.PropertySource
public class LawOfDemeterRule extends AbstractJavaRule
This rule can detect possible violations of the Law of Demeter. The Law of Demeter is a simple rule, that says "only talk to friends". It helps to reduce coupling between classes or objects.See:
- Andrew Hunt, David Thomas, and Ward Cunningham. The Pragmatic Programmer. From Journeyman to Master. Addison-Wesley Longman, Amsterdam, October 1999.
- K.J. Lieberherr and I.M. Holland. Assuring good style for object-oriented programs. Software, IEEE, 6(5):38–48, 1989.
- Author:
- Clément Fournier
- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description LawOfDemeterRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(net.sourceforge.pmd.lang.ast.Node target, net.sourceforge.pmd.reporting.RuleContext ctx)
Object
visit(ASTFieldAccess node, Object data)
Object
visit(ASTMethodCall node, Object data)
-
Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
visitNode
-
Methods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule
addExample, asCtx, buildTargetSelector, deepCopy, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getPriority, getPropertySourceType, getRuleClass, getRuleSetName, getSince, getTargetSelector, hashCode, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, start
-
Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
definePropertyDescriptor, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setProperty
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaVisitor
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, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitJavaNode
-
Methods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setProperty
-
-
-
-
Method Detail
-
apply
public void apply(net.sourceforge.pmd.lang.ast.Node target, net.sourceforge.pmd.reporting.RuleContext ctx)
- Specified by:
apply
in interfacenet.sourceforge.pmd.lang.rule.Rule
- Overrides:
apply
in classAbstractJavaRule
-
visit
public Object visit(ASTFieldAccess node, Object data)
-
visit
public Object visit(ASTMethodCall node, Object data)
-
-