Class AbstractClassCouplingCheck.ClassContext

    • Constructor Detail

      • ClassContext

        private ClassContext​(String className,
                             DetailAST ast)
        Create new context associated with given class.
        Parameters:
        className - name of the given class.
        ast - ast of class definition.
    • Method Detail

      • visitLiteralThrows

        public void visitLiteralThrows​(DetailAST literalThrows)
        Visits throws clause and collects all exceptions we throw.
        Parameters:
        literalThrows - throws to process.
      • visitType

        public void visitType​(DetailAST ast)
        Visits type.
        Parameters:
        ast - type to process.
      • addReferencedClassName

        private void addReferencedClassName​(DetailAST ast)
        Adds new referenced class.
        Parameters:
        ast - a node which represents referenced class.
      • addReferencedClassName

        private void addReferencedClassName​(String referencedClassName)
        Adds new referenced class.
        Parameters:
        referencedClassName - class name of the referenced class.
      • checkCoupling

        public void checkCoupling()
        Checks if coupling less than allowed or not.
      • isSignificant

        private boolean isSignificant​(String candidateClassName)
        Checks if given class shouldn't be ignored and not from java.lang.
        Parameters:
        candidateClassName - class to check.
        Returns:
        true if we should count this class.
      • isFromExcludedPackage

        private boolean isFromExcludedPackage​(String candidateClassName)
        Checks if given class should be ignored as it belongs to excluded package.
        Parameters:
        candidateClassName - class to check
        Returns:
        true if we should not count this class.
      • getClassNameWithPackage

        private Optional<StringgetClassNameWithPackage​(String examineClassName)
        Retrieves class name with packages. Uses previously registered imports to get the full class name.
        Parameters:
        examineClassName - Class name to be retrieved.
        Returns:
        Class name with package name, if found, Optional.empty() otherwise.
      • isExcludedClassRegexp

        private boolean isExcludedClassRegexp​(String candidateClassName)
        Checks if given class should be ignored as it belongs to excluded class regexp.
        Parameters:
        candidateClassName - class to check.
        Returns:
        true if we should not count this class.