Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.core.runtime
Class PluginVersionIdentifier

    java.lang.Object
      org.eclipse.core.runtime.PluginVersionIdentifier

public final class PluginVersionIdentifier
extends Object

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):

- `0.0.0`
- `1.0.127564`
- `3.7.2.build-127J`
- `1.9` (interpreted as `1.9.0`)
- `3` (interpreted as `3.0.0`)

The version identifier can be decomposed into a major, minor, service 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 service level component is interpreted as a cumulative and compatible service 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.

See Also:
  `String.compareTo(java.lang.String)`

Constructor Summary
`PluginVersionIdentifier(int major, int minor, int service)` Creates a plug-in version identifier from its components.
`PluginVersionIdentifier(int major, int minor, int service, String qualifier)` Creates a plug-in version identifier from its components.
`PluginVersionIdentifier(String versionId)` Creates a plug-in version identifier from the given string.

Method Summary
`boolean` | `equals(Object object)` Compare version identifiers for equality.
`int` | `getMajorComponent()` Returns the major (incompatible) component of this version identifier.
`int` | `getMinorComponent()` Returns the minor (compatible) component of this version identifier.
`String` | `getQualifierComponent()` Returns the qualifier component of this version identifier.
`int` | `getServiceComponent()` Returns the service level component of this version identifier.
`int` | `hashCode()` Returns a hash code value for the object.
`boolean` | `isCompatibleWith(PluginVersionIdentifier id)` Compares two version identifiers for compatibility.
`boolean` | `isEquivalentTo(PluginVersionIdentifier id)` Compares two version identifiers for equivalency.
`boolean` | `isGreaterOrEqualTo(PluginVersionIdentifier id)` Compares two version identifiers to see if this one is greater than or equal to the argument.
`boolean` | `isGreaterThan(PluginVersionIdentifier id)` Compares two version identifiers for order using multi-decimal comparison.
`boolean` | `isPerfect(PluginVersionIdentifier id)` Compares two version identifiers for perfect equality.
`String` | `toString()` Returns the string representation of this version identifier.
`static IStatus` | `validateVersion(String version)` Validates the given string as a plug-in version identifier.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PluginVersionIdentifier

    public PluginVersionIdentifier(int major,
                                   int minor,
                                   int service)

  Creates a plug-in version identifier from its components.

Parameters:
  `major` - major component of the version identifier
  `minor` - minor component of the version identifier
  `service` - service update component of the version identifier

### PluginVersionIdentifier

    public PluginVersionIdentifier(int major,
                                   int minor,
                                   int service,
                                   String qualifier)

  Creates a plug-in version identifier from its components.

Parameters:
  `major` - major component of the version identifier
  `minor` - minor component of the version identifier
  `service` - service update component of the version identifier
  `qualifier` - qualifier component of the version identifier. Qualifier characters that are not a letter or a digit are replaced.

### PluginVersionIdentifier

    public PluginVersionIdentifier(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`)

Parameters:
  `versionId` - string representation of the version identifier. Qualifier characters that are not a letter or a digit are replaced.

Method Detail

### validateVersion

    public static IStatus validateVersion(String version)

  Validates the given string as a plug-in version identifier.

  Parameters:
    `version` - the string to validate
  Returns:
    a status object with code `IStatus.OK` if the given string is valid as a plug-in version identifier, otherwise a status object indicating what is wrong with the string
  Since:
    2.0

### equals

    public boolean equals(Object object)

  Compare version identifiers for equality. Identifiers are equal if all of their components are equal.

  Parameters:
    `object` - an object to compare
  Returns:
    whehter or not the two objects are equal

### hashCode

    public int hashCode()

  Returns a hash code value for the object.

  Returns:
    an integer which is a hash code value for this object.

### getMajorComponent

    public int getMajorComponent()

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

  Returns:
    the major version

### getMinorComponent

    public int getMinorComponent()

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

  Returns:
    the minor version

### getServiceComponent

    public int getServiceComponent()

  Returns the service level component of this version identifier.

  Returns:
    the service level

### getQualifierComponent

    public String getQualifierComponent()

  Returns the qualifier component of this version identifier.

  Returns:
    the qualifier

### isGreaterOrEqualTo

    public boolean isGreaterOrEqualTo(PluginVersionIdentifier id)

  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 service component is greater than the argument service component, or the major, minor and service components are equal and the qualifier component is greated than the argument qualifier component (using lexicographic string comparison), or all components are equal.

  Parameters:
    `id` - the other version identifier
  Returns:
    `true` is this version identifier is compatible with the given version identifier, and `false` otherwise
  Since:
    2.0

### isCompatibleWith

    public boolean isCompatibleWith(PluginVersionIdentifier id)

  Compares two version identifiers for compatibility.

  A version identifier is considered to be compatible 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 service level of the version identifier must be greater than or equal to the service level of the argument identifier. If the service 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).

  Parameters:
    `id` - the other version identifier
  Returns:
    `true` is this version identifier is compatible with the given version identifier, and `false` otherwise

### isEquivalentTo

    public boolean isEquivalentTo(PluginVersionIdentifier id)

  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 service level as the argument. If the service 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).

  Parameters:
    `id` - the other version identifier
  Returns:
    `true` is this version identifier is equivalent to the given version identifier, and `false` otherwise

### isPerfect

    public boolean isPerfect(PluginVersionIdentifier id)

  Compares two version identifiers for perfect equality.

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

  Parameters:
    `id` - the other version identifier
  Returns:
    `true` is this version identifier is perfectly equal to the given version identifier, and `false` otherwise
  Since:
    2.0

### isGreaterThan

    public boolean isGreaterThan(PluginVersionIdentifier id)

  Compares two version identifiers for order using multi-decimal comparison.

  Parameters:
    `id` - the other version identifier
  Returns:
    `true` is this version identifier is greater than the given version identifier, and `false` otherwise

### toString

    public String toString()

  Returns the string representation of this version identifier. The result satisfies `vi.equals(new PluginVersionIdentifier(vi.toString()))`.

  Returns:
    the string representation of this plug-in version identifier

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.