Class DependencyCheckerHelper


  • @OpenApi
    public final class DependencyCheckerHelper
    extends java.lang.Object
    Utility class that allows to check dependencies between modules of a project.
    Example:
     Project project = Application.getInstance.getProject();
     DependencyCheckResult result = DependencyCheckerHelper.checkDependencies(project);
     if (result.hasDependencies()) {
         System.out.println("Modules of the project has dependencies");
         System.out.println("Cyclic dependencies: " + result.hasCyclicDependencies());
         System.out.println("Number of dependencies between modules/project: " + result.getDependencies().size());
     }
     else {
         System.out.println("Modules of the project has no dependencies");
     }
     
    • Constructor Detail

      • DependencyCheckerHelper

        private DependencyCheckerHelper()
        Hidden constructor. The class is not intended for extending and no instances should be created.
    • Method Detail

      • checkDependencies

        @OpenApi
        public static DependencyCheckResult checkDependencies​(Project project)
        Checks dependencies between modules and project in the specified project. Dependencies of the system profiles will not be analyzed.
        Note: Project can be active or not active BUT if the project is not active then the method will set the specified project as active and after dependencies checking previous active project will be set as active.
        Parameters:
        project - a project.
        Returns:
        result of dependency checking.
        Throws:
        java.lang.IllegalArgumentException - if project is null.
      • checkDependencies

        @OpenApi
        public static DependencyCheckResult checkDependencies​(Project project,
                                                              java.util.Collection<Package> importantPackages)
        Checks dependencies between modules and project in the specified project and returns dependencies only between specified important packages. The specified important packages must be from the specified project. Dependencies of the system profiles will not be analyzed.
        Note: Project can be active or not active BUT if the project is not active then the method will set the specified project as active and after dependencies checking previous active project will be set as active.
        Parameters:
        project - a project.
        importantPackages - packages(modules) which dependencies are important. null - means that all packages are important.
        Returns:
        result of dependency checking.
        Throws:
        java.lang.IllegalArgumentException - if project is null or if at least one package is not from the specified project.
      • checkDependencies

        @OpenApi
        public static DependencyCheckResult checkDependencies​(Project project,
                                                              java.util.Collection<Package> importantPackages,
                                                              boolean ignoreSystemProfiles)
        Checks dependencies between modules and project in the specified project and returns dependencies only between specified important packages. The specified important packages must be from the specified project.
        Note: Project can be active or not active BUT if the project is not active then the method will set the specified project as active and after dependencies checking previous active project will be set as active.
        Parameters:
        project - a project.
        importantPackages - packages(modules) which dependencies are important. null - means that all packages are important.
        ignoreSystemProfiles - specifies that system profiles must be ignored or not in dependency analysis.
        Returns:
        result of dependency checking.
        Throws:
        java.lang.IllegalArgumentException - if project is null or if at least one package is not from the specified project.
      • doCheckDependencies

        private static DependencyCheckResult doCheckDependencies​(Project project,
                                                                 java.util.Collection<Package> importantPackages,
                                                                 boolean ignoreSystemProfiles)
        Implements actual checking of dependencies.
        Parameters:
        project - a project in which dependencies checking must be performed.
        importantPackages - packages(modules) which dependencies are important.
        ignoreSystemProfiles - specifies that system profiles must be ignored in dependency analysis.
        Returns:
        result of dependency checking.