Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.osgi.service.resolver
Class Version  view Version download Version.java

java.lang.Object
  extended byorg.eclipse.osgi.service.resolver.Version
All Implemented Interfaces:
java.lang.Comparable

public final class Version
extends java.lang.Object
implements java.lang.Comparable

Version identifier for a plug-in. In its string representation, it consists of up to 4 tokens separated by a decimal point. The first 3 tokens are positive integer numbers, the last token is an uninterpreted string (no whitespace characters allowed). For example, the following are valid version identifiers (as strings):

The version identifier can be decomposed into a major, minor, micro level component and qualifier components. A difference in the major component is interpreted as an incompatible version change. A difference in the minor (and not the major) component is interpreted as a compatible version change. The micro level component is interpreted as a cumulative and compatible micro update of the minor version component. The qualifier is not interpreted, other than in version comparisons. The qualifiers are compared using lexicographical string comparison.

Version identifiers can be matched as perfectly equal, equivalent, compatible or greaterOrEqual.

Clients may instantiate; not intended to be subclassed by clients.


Field Summary
static Version emptyVersion
           
private  boolean inclusive
           
private  int major
           
static Version maxVersion
           
private  int micro
           
private  int minor
           
private  java.lang.String qualifier
           
private static java.lang.String SEPARATOR
           
 
Constructor Summary
Version(int major, int minor, int micro)
          Creates a plug-in version identifier from its components.
Version(int major, int minor, int micro, java.lang.String qualifier)
          Creates a plug-in version identifier from its components.
Version(int major, int minor, int micro, java.lang.String qualifier, boolean inclusive)
          Creates a plug-in version identifier from its components.
Version(java.lang.String versionId)
          Creates a plug-in version identifier from the given string.
Version(java.lang.String versionId, boolean inclusive)
          Creates a plug-in version identifier from the given string.
Version(Version version)
          Creates a plug-in version identifier from a given Version.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this Version object with the specified Version object for order.
 boolean equals(java.lang.Object object)
          Compare version identifiers for equality.
 int getMajorComponent()
          Returns the major (incompatible) component of this version identifier.
 int getMicroComponent()
          Returns the micro level component of this version identifier.
 int getMinorComponent()
          Returns the minor (compatible) component of this version identifier.
 java.lang.String getQualifierComponent()
          Returns the qualifier component of this version identifier.
 int hashCode()
          Returns a hash code value for the object.
 boolean isGreaterThan(Version id)
          Compares two version identifiers for order using multi-decimal comparison.
 boolean isInclusive()
          Returns whether this Version is inclusive when used as a VersionRange minimum or maximum.
 boolean matchGreaterOrEqualTo(Version id)
          Deprecated. use VersionRange
 boolean matchMajor(Version id)
          Deprecated. use VersionRange
 boolean matchMicro(Version id)
          Deprecated. use VersionRange
 boolean matchMinor(Version id)
          Deprecated. use VersionRange
 boolean matchQualifier(Version id)
          Deprecated. use VersionRange
private static java.lang.Object[] parseVersion(java.lang.String versionId)
           
 java.lang.String toString()
          Returns the string representation of this version identifier.
private static java.lang.String verifyQualifier(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

major

private int major

minor

private int minor

micro

private int micro

qualifier

private java.lang.String qualifier

inclusive

private boolean inclusive

SEPARATOR

private static final java.lang.String SEPARATOR
See Also:
Constant Field Values

emptyVersion

public static Version emptyVersion

maxVersion

public static Version maxVersion
Constructor Detail

Version

public Version(Version version)
Creates a plug-in version identifier from a given Version.


Version

public Version(int major,
               int minor,
               int micro)
Creates a plug-in version identifier from its components.


Version

public Version(int major,
               int minor,
               int micro,
               java.lang.String qualifier)
        throws java.lang.IllegalArgumentException
Creates a plug-in version identifier from its components.


Version

public Version(int major,
               int minor,
               int micro,
               java.lang.String qualifier,
               boolean inclusive)
        throws java.lang.IllegalArgumentException
Creates a plug-in version identifier from its components.


Version

public Version(java.lang.String versionId)
Creates a plug-in version identifier from the given string. The string represenation consists of up to 4 tokens separated by decimal point. For example, the following are valid version identifiers (as strings):
  • 0.0.0
  • 1.0.127564
  • 3.7.2.build-127J
  • 1.9 (interpreted as 1.9.0)
  • 3 (interpreted as 3.0.0)


Version

public Version(java.lang.String versionId,
               boolean inclusive)
Creates a plug-in version identifier from the given string. The string represenation consists of up to 4 tokens separated by decimal point. For example, the following are valid version identifiers (as strings):
  • 0.0.0
  • 1.0.127564
  • 3.7.2.build-127J
  • 1.9 (interpreted as 1.9.0)
  • 3 (interpreted as 3.0.0)

Method Detail

parseVersion

private static java.lang.Object[] parseVersion(java.lang.String versionId)

equals

public boolean equals(java.lang.Object object)
Compare version identifiers for equality. Identifiers are equal if all of their components are equal.


hashCode

public int hashCode()
Returns a hash code value for the object.


getMajorComponent

public int getMajorComponent()
Returns the major (incompatible) component of this version identifier.


getMinorComponent

public int getMinorComponent()
Returns the minor (compatible) component of this version identifier.


getMicroComponent

public int getMicroComponent()
Returns the micro level component of this version identifier.


getQualifierComponent

public java.lang.String getQualifierComponent()
Returns the qualifier component of this version identifier.


isInclusive

public boolean isInclusive()
Returns whether this Version is inclusive when used as a VersionRange minimum or maximum.


matchGreaterOrEqualTo

public boolean matchGreaterOrEqualTo(Version id)
Deprecated. use VersionRange

Compares two version identifiers to see if this one is greater than or equal to the argument.

A version identifier is considered to be greater than or equal if its major component is greater than the argument major component, or the major components are equal and its minor component is greater than the argument minor component, or the major and minor components are equal and its micro component is greater than the argument micro component, or the major, minor and micro components are equal and the qualifier component is greated than the argument qualifier component (using lexicographic string comparison), or all components are equal.


matchMajor

public boolean matchMajor(Version id)
Deprecated. use VersionRange

Compares two version identifiers for major match.

A version identifier is considered to match on major if its major component equals to the argument major component, and its minor component is greater than or equal to the argument minor component. If the minor components are equal, than the micro level of the version identifier must be greater than or equal to the micro level of the argument identifier. If the micro levels are equal, the two version identifiers are considered to be equivalent if this qualifier is greated or equal to the qualifier of the argument (using lexicographic string comparison).


matchMinor

public boolean matchMinor(Version id)
Deprecated. use VersionRange

Compares two version identifiers for equivalency.

Two version identifiers are considered to be equivalent if their major and minor component equal and are at least at the same micro level as the argument. If the micro levels are equal, the two version identifiers are considered to be equivalent if this qualifier is greated or equal to the qualifier of the argument (using lexicographic string comparison).


matchMicro

public boolean matchMicro(Version id)
Deprecated. use VersionRange

Compares two version identifiers for micro match.

Two version identifiers are considered to micro match if their major, minor and micro components equal and this qualifier is greated or equal to the qualifier of the argument (using lexicographic string comparison).


matchQualifier

public boolean matchQualifier(Version id)
Deprecated. use VersionRange

Compares two version identifiers for perfect equality.

Two version identifiers are considered to be perfectly equal if their major, minor, micro and qualifier components are equal


isGreaterThan

public boolean isGreaterThan(Version id)
Compares two version identifiers for order using multi-decimal comparison.


toString

public java.lang.String toString()
Returns the string representation of this version identifier. The result satisfies vi.equals(new PluginVersionIdentifier(vi.toString())).


verifyQualifier

private static java.lang.String verifyQualifier(java.lang.String s)

compareTo

public int compareTo(java.lang.Object o)
Compares this Version object with the specified Version object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable