Package com.sodius.oslc.app.jazz.model
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 ajfs: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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PublisherVersion o)
boolean
equals(Object obj)
Determines whether the given argument is a PublisherVersion instance holding the exact same version as this instance.int
hashCode()
boolean
isCompliantWith(PublisherVersion version)
Determines whether this instance is compatible with the given version, meaning it is either the same version or is higher.static Optional<PublisherVersion>
of(Publisher publisher)
Parses the version of the given Publisher resource, if any.static PublisherVersion
parse(String version)
Parses the given Publisher version.String
toString()
-
-
-
Method Detail
-
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 ajfs: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.
-
equals
public boolean equals(Object obj)
Determines whether the given argument 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 interfaceComparable<PublisherVersion>
-
-