|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.virtuosotechnologies.lib.plugin.APIVersion
Version number of an API and API implementation.
The version has the form major.minor.impl. The three parts have well-defined semantics as follows.
For example, a client may request version 1.2 of a particular API. That client should be compatible with an implementation of version 1.2.0, 1.2.1, or 1.3.0, but not 1.1.0 or 2.0.0. A client may also request a particular minimum implementation version, by requesting version 1.2.2 for example. (This may be because, for example, it knows that earlier implementations have bugs that affect its operation.) That client would then be compatible with implementation version 1.2.2, 1.2.3 or 1.3.0, but not 1.2.1.
There is also a notion of "how well" an implementation version fits a client's request. Minor revisions closer to the requested revision are better fits, and later implementation versions are considered better fits. For example, if version 1.2.2 is requested then implementation 1.2.5 is a better fit than either implementations 1.3.5 or 1.2.2. This "fit quality" can be queried by using the request APIVersion as a Comparator for implementation APIVersions.
Constructor Summary | |
APIVersion(int majorVersion,
int minorVersion)
Constructor. |
|
APIVersion(int majorVersion,
int minorVersion,
int implVersion)
Constructor |
Method Summary | |
int |
compare(Object obj1,
Object obj2)
Implementation of Comparator. |
int |
compareTo(Object obj)
Implementation of Comparable. |
boolean |
equals(Object obj)
equals |
APIVersion |
getBestProvidingVersion(Collection collection)
Get the APIVersion out of a Collection that best provides what this version requests. |
int |
hashCode()
hashCode |
boolean |
isSatisfiedBy(APIVersion provider)
Is this version satisfied by the given provider? |
static APIVersion |
parse(String str)
Parse from a string. |
String |
toString()
Unparses the version to a string form suitable for reparsing using the parse() method. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public APIVersion(int majorVersion, int minorVersion, int implVersion)
majorVersion
- major version numberminorVersion
- minor version numberimplVersion
- implementation version numberpublic APIVersion(int majorVersion, int minorVersion)
majorVersion
- major version numberminorVersion
- minor version numberMethod Detail |
public boolean isSatisfiedBy(APIVersion provider)
provider
- the provided API version
public int compareTo(Object obj)
compareTo
in interface Comparable
obj
- other object
ClassCastException
- one of the parameters is not an APIVersion.public int compare(Object obj1, Object obj2)
compare
in interface Comparator
obj1
- first objectobj2
- second object
ClassCastException
- one of the parameters is not an APIVersion.public APIVersion getBestProvidingVersion(Collection collection)
collection
- collection of APIVersions
public static APIVersion parse(String str)
str
- string to parse
public boolean equals(Object obj)
equals
in interface Comparator
obj
- object to compare to
public int hashCode()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |