Class AbstractJavaClassMetric
- java.lang.Object
-
- net.sourceforge.pmd.lang.metrics.AbstractMetric<N>
-
- net.sourceforge.pmd.lang.java.metrics.AbstractJavaMetric<ASTAnyTypeDeclaration>
-
- net.sourceforge.pmd.lang.java.metrics.impl.AbstractJavaClassMetric
-
- All Implemented Interfaces:
JavaClassMetric
,net.sourceforge.pmd.lang.metrics.Metric<ASTAnyTypeDeclaration>
- Direct Known Subclasses:
AtfdMetric.AtfdClassMetric
,ClassFanOutMetric.ClassFanOutClassMetric
,LocMetric.LocClassMetric
,NcssMetric.NcssClassMetric
,NoamMetric
,NopaMetric
,TccMetric
,WmcMetric
,WocMetric
public abstract class AbstractJavaClassMetric extends AbstractJavaMetric<ASTAnyTypeDeclaration> implements JavaClassMetric
Base class for class metrics.- Author:
- Clément Fournier
-
-
Constructor Summary
Constructors Constructor Description AbstractJavaClassMetric()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
countMatchingFieldSigs(ASTAnyTypeDeclaration classNode, JavaFieldSigMask mask)
Counts the fields matching the signature mask in this class.protected int
countMatchingOpSigs(ASTAnyTypeDeclaration classNode, JavaOperationSigMask mask)
Counts the operations matching the signature mask in this class.protected java.util.List<ASTFieldDeclaration>
getFields(ASTAnyTypeDeclaration node)
Gets a list of all fields declared in the class.protected java.util.List<ASTMethodOrConstructorDeclaration>
getMethodsAndConstructors(ASTAnyTypeDeclaration node)
Gets a list of all methods and constructors declared in the class.boolean
supports(ASTAnyTypeDeclaration node)
Returns true if the metric can be computed on this type declaration.
-
-
-
Method Detail
-
supports
public boolean supports(ASTAnyTypeDeclaration node)
Returns true if the metric can be computed on this type declaration. By default, annotation and interface declarations are filtered out.- Specified by:
supports
in interfacenet.sourceforge.pmd.lang.metrics.Metric<ASTAnyTypeDeclaration>
- Parameters:
node
- The type declaration- Returns:
- True if the metric can be computed on this type declaration
-
countMatchingOpSigs
protected int countMatchingOpSigs(ASTAnyTypeDeclaration classNode, JavaOperationSigMask mask)
Counts the operations matching the signature mask in this class.- Parameters:
classNode
- The class on which to countmask
- The mask- Returns:
- The number of operations matching the signature mask
-
countMatchingFieldSigs
protected int countMatchingFieldSigs(ASTAnyTypeDeclaration classNode, JavaFieldSigMask mask)
Counts the fields matching the signature mask in this class.- Parameters:
classNode
- The class on which to countmask
- The mask- Returns:
- The number of fields matching the signature mask
-
getMethodsAndConstructors
protected java.util.List<ASTMethodOrConstructorDeclaration> getMethodsAndConstructors(ASTAnyTypeDeclaration node)
Gets a list of all methods and constructors declared in the class.- Parameters:
node
- The class- Returns:
- The list of all methods and constructors
-
getFields
protected java.util.List<ASTFieldDeclaration> getFields(ASTAnyTypeDeclaration node)
Gets a list of all fields declared in the class.- Parameters:
node
- The class- Returns:
- The list of all fields
-
-