Package org.eclipse.equinox.p2.metadata
Class VersionedId
- java.lang.Object
-
- org.eclipse.equinox.p2.metadata.VersionedId
-
- All Implemented Interfaces:
IVersionedId
public class VersionedId extends Object implements IVersionedId
An object representing a (id,version) pair. An instance of this class can be constructed by invoking the constructor or callingparse(String)with a string representation of this VersionedID.- Since:
- 2.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Constructor Description VersionedId(String id, String version)Creates a new versioned id with the given id and version.VersionedId(String id, Version version)Creates a new versioned id with the given id and version.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetId()Returns the id portion of this versioned id.VersiongetVersion()Returns the version portion of this versioned id.inthashCode()static IVersionedIdparse(String spec)Creates and returns a newVersionedIdfrom the given string specification.StringtoString()Returns a string representation of this versioned id.
-
-
-
Constructor Detail
-
VersionedId
public VersionedId(String id, String version)
Creates a new versioned id with the given id and version.- Parameters:
id- The identifierversion- The version- Throws:
IllegalArgumentException- Ifversionis improperly formatted.
-
-
Method Detail
-
parse
public static IVersionedId parse(String spec)
Creates and returns a newVersionedIdfrom the given string specification. The specification must be of the form "id/version", or just "id" if the version is absentThis factory method can be used to reconstruct a
VersionedIdinstance from the string representation produced by a previous invocation oftoString().- Parameters:
spec- the specification for the versioned id to create- Returns:
- the parsed versioned id
- Throws:
IllegalArgumentException- Ifspecis improperly formatted.
-
getId
public String getId()
Description copied from interface:IVersionedIdReturns the id portion of this versioned id.- Specified by:
getIdin interfaceIVersionedId- Returns:
- the ID of this VersionedID
-
getVersion
public Version getVersion()
Description copied from interface:IVersionedIdReturns the version portion of this versioned id.- Specified by:
getVersionin interfaceIVersionedId- Returns:
- the Version of this VersionedID
-
toString
public String toString()
Returns a string representation of this versioned id. The result can be used to later construct an equalVersionedIdinstance using {parse(String).
-
-