Class DependencyCheckerHelper

java.lang.Object
com.nomagic.magicdraw.dependency.DependencyCheckerHelper

@OpenApi public final class DependencyCheckerHelper extends 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");
 }
 
Version:
1.0
  • Method Details

    • 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:
      IllegalArgumentException - if project is null.
    • checkDependencies

      @OpenApi public static DependencyCheckResult checkDependencies(Project project, 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:
      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, 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:
      IllegalArgumentException - if project is null or if at least one package is not from the specified project.