Class PublisherVersion

java.lang.Object
com.sodius.oslc.app.jazz.model.PublisherVersion
All Implemented Interfaces:
Comparable<PublisherVersion>

public class PublisherVersion extends Object implements Comparable<PublisherVersion>
Represents the version of a Publisher resource, usually set using a jfs:version property. Enables comparing two version instances, to determine if the version of the actual friend application is compatible with an expected reference version.
Since:
1.13.0
  • Method Details

    • of

      public static Optional<PublisherVersion> of(Publisher publisher) throws IllegalArgumentException
      Parses the version of the given Publisher resource, if any. The version information is set in a jfs:version property, which may not be present for some Publishers.
      Parameters:
      publisher - the Publisher resource for which the version is to determine.
      Returns:
      an Optional holding the parsed jfs:version property, Optional.empty() if none
      Throws:
      IllegalArgumentException - if the version string contains characters that are not expected for a Publisher version.
    • parse

      public static PublisherVersion parse(String version) throws IllegalArgumentException
      Parses the given Publisher version.
      Parameters:
      version - the Publisher version string
      Returns:
      a PublisherVersion instance.
      Throws:
      IllegalArgumentException - if the version string contains characters that are not expected for a Publisher version.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Determines whether the given argument is a PublisherVersion instance holding the exact same version as this instance.
      Overrides:
      equals in class Object
      Returns:
      true if the obj is a PublisherVersion instance holding the exact same version as this instance.
    • isCompliantWith

      public boolean isCompliantWith(PublisherVersion version)
      Determines whether this instance is compatible with the given version, meaning it is either the same version or is higher. This method is suitable to determine if the version of the actual friend application is compatible with an expected reference version.
      Parameters:
      version - the reference version to test
      Returns:
      true if this version is equal to the given version or is higher.
    • compareTo

      public int compareTo(PublisherVersion o)
      Specified by:
      compareTo in interface Comparable<PublisherVersion>
    • toString

      public String toString()
      Overrides:
      toString in class Object