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
,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 List<ASTFieldDeclaration>
getFields(ASTAnyTypeDeclaration node)
Gets a list of all fields declared in the class.protected 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.-
Methods inherited from class net.sourceforge.pmd.lang.metrics.AbstractMetric
equals, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.metrics.Metric
computeFor
-
-
-
-
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 interfaceMetric<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 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 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
-
-