Class AbstractJavaClassMetric

    • Constructor Detail

      • AbstractJavaClassMetric

        public AbstractJavaClassMetric()
    • 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 interface net.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 count
        mask - 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 count
        mask - 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