Class DependencyUtil


  • public class DependencyUtil
    extends java.lang.Object
    Dependency Utilities
    • Constructor Summary

      Constructors 
      Constructor Description
      DependencyUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Dependency[] add​(Dependency[] deps, Dependency dep)
      Adds an dependency to the give package if it is not already contained in the given list.
      static Dependency[] addExact​(Dependency[] deps, PackageId id)
      Adds an exact dependency to the give package if it is not already contained in the given list.
      static boolean matches​(Dependency[] deps, PackageId id)
      Checks if any of the dependencies matches the given id
      static java.util.List<PackageId> resolve​(java.util.Map<PackageId,​Dependency[]> list)
      Resolves a list of resolutions respecting their internal dependency references.
      static <T extends VaultPackage>
      void
      sort​(java.util.Collection<T> packages)
      Sorts the packages by the dependency order
      static <T extends JcrPackage>
      void
      sortPackages​(java.util.Collection<T> packages)
      Sorts the packages by the dependency order
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DependencyUtil

        public DependencyUtil()
    • Method Detail

      • sort

        public static <T extends VaultPackage> void sort​(java.util.Collection<T> packages)
                                                  throws CyclicDependencyException
        Sorts the packages by the dependency order
        Type Parameters:
        T - Type of the collection.
        Parameters:
        packages - packages to sort
        Throws:
        CyclicDependencyException - if a cyclic dependency is detected
      • matches

        public static boolean matches​(@Nonnull
                                      Dependency[] deps,
                                      @Nonnull
                                      PackageId id)
        Checks if any of the dependencies matches the given id
        Parameters:
        deps - the list of dependencies
        id - the id
        Returns:
        true if matches
      • addExact

        public static Dependency[] addExact​(@Nonnull
                                            Dependency[] deps,
                                            @Nonnull
                                            PackageId id)
        Adds an exact dependency to the give package if it is not already contained in the given list.
        Parameters:
        deps - the original dependencies
        id - the id to add
        Returns:
        the new array of dependencies, or deps if nothing changed.
      • add

        public static Dependency[] add​(@Nonnull
                                       Dependency[] deps,
                                       @Nonnull
                                       Dependency dep)
        Adds an dependency to the give package if it is not already contained in the given list. version ranges are current ignored.
        Parameters:
        deps - the original dependencies
        dep - the dependency to add
        Returns:
        the new array of dependencies, or deps if nothing changed.