Class Dependency


  • public class Dependency
    extends Object
    Implements a package dependency reference.
    Since:
    2.0
    • Field Detail

      • EMPTY

        public static final Dependency[] EMPTY
        An empty dependency array
    • Constructor Detail

      • Dependency

        public Dependency​(@Nonnull
                          PackageId id)
        Creates a new dependency to the specified package id
        Parameters:
        id - package id.
    • Method Detail

      • getGroup

        @Nonnull
        public String getGroup()
        Returns the group of the dependency
        Returns:
        the group id
        Since:
        2.4
      • getName

        @Nonnull
        public String getName()
        Returns the name of the dependency
        Returns:
        the name
      • getRange

        @Nonnull
        public VersionRange getRange()
        Returns the version range
        Returns:
        the version range
      • getPath

        @Deprecated
        @Nonnull
        public String getPath()
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        Returns the installation path of this dependency
        Returns:
        the installation path;
      • matches

        public boolean matches​(@Nonnull
                               PackageId id)
        Checks if the given package id matches this dependency specification.
        Parameters:
        id - the package id
        Returns:
        true if matches
      • fromString

        @Nullable
        public static Dependency fromString​(@Nullable
                                            String str)
        Returns a dependency from a string. if the given id is null or an empty string, null is returned.
        Parameters:
        str - the string
        Returns:
        the dependency
      • fromString

        @Nonnull
        public static Dependency[] fromString​(@Nonnull
                                              String... str)
        Returns dependencies from the given strings.
        Parameters:
        str - the strings
        Returns:
        the dependencies
      • toString

        @Nonnull
        public static String toString​(@Nonnull
                                      Dependency... deps)
        Returns a string representation from given dependencies.
        Parameters:
        deps - the dependencies
        Returns:
        the strings
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object