Class Dependency


  • public class Dependency
    extends java.lang.Object
    Implements a package dependency reference. The string representation is <group>:<name>[:<versionrange>]
    Since:
    2.0
    See Also:
    VersionRange
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Dependency[] EMPTY
      An empty dependency array
    • Constructor Summary

      Constructors 
      Constructor Description
      Dependency​(@NotNull java.lang.String groupId, @NotNull java.lang.String name, @Nullable VersionRange range)
      Creates a new dependency reference.
      Dependency​(@NotNull PackageId id)
      Creates a new dependency to the specified package id
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(@Nullable java.lang.Object obj)  
      static @NotNull Dependency[] fromString​(@NotNull java.lang.String... str)
      Returns dependencies from the given strings.
      static @Nullable Dependency fromString​(@Nullable java.lang.String str)
      Returns a dependency from a string.
      @NotNull java.lang.String getGroup()
      Returns the group of the dependency
      @NotNull java.lang.String getName()
      Returns the name of the dependency
      @NotNull java.lang.String getPath()
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
      @NotNull VersionRange getRange()
      Returns the version range
      int hashCode()  
      boolean matches​(@NotNull PackageId id)
      Checks if the given package id matches this dependency specification.
      static @NotNull Dependency[] parse​(@NotNull java.lang.String str)
      Parses a string serialization of dependencies generated by toString(Dependency...).
      @NotNull java.lang.String toString()  
      static @NotNull java.lang.String toString​(@NotNull Dependency... deps)
      Returns a string representation from given dependencies.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • EMPTY

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

      • Dependency

        public Dependency​(@NotNull
                          @NotNull java.lang.String groupId,
                          @NotNull
                          @NotNull java.lang.String name,
                          @Nullable
                          @Nullable VersionRange range)
        Creates a new dependency reference.
        Parameters:
        groupId - group id
        name - name
        range - version range
      • Dependency

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

      • getGroup

        @NotNull
        public @NotNull java.lang.String getGroup()
        Returns the group of the dependency
        Returns:
        the group id
        Since:
        2.4
      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Returns the name of the dependency
        Returns:
        the name
      • getRange

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

        @Deprecated
        @NotNull
        public @NotNull java.lang.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​(@NotNull
                               @NotNull 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 @Nullable Dependency fromString​(@Nullable
                                                      @Nullable java.lang.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
      • parse

        @NotNull
        public static @NotNull Dependency[] parse​(@NotNull
                                                  @NotNull java.lang.String str)
        Parses a string serialization of dependencies generated by toString(Dependency...).
        Parameters:
        str - serialized string
        Returns:
        array of dependency references
      • fromString

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

        @NotNull
        public static @NotNull java.lang.String toString​(@NotNull
                                                         @NotNull Dependency... deps)
        Returns a string representation from given dependencies. Dependencies are separated by ','.
        Parameters:
        deps - the dependencies
        Returns:
        the strings
      • toString

        @NotNull
        public @NotNull java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object