com.microsoft.tfs.core.clients.versioncontrol.specs.version
Class VersionSpec

java.lang.Object
  extended by com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
      extended by com.microsoft.tfs.core.clients.versioncontrol.specs.version.VersionSpec
Direct Known Subclasses:
ChangesetVersionSpec, DateVersionSpec, DeletionVersionSpec, LabelVersionSpec, LatestVersionSpec, WorkspaceVersionSpec

public abstract class VersionSpec
extends com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper

A VersionSpec represents a specific version of some version control, although the item identity is not part of this object (see VersionedFileSpec for this representation). This class is the base class of all concrete version spec classes. All version spec classes are immutable.

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Field Summary
static char RANGE_DELIMITER
          Separates the (possibly) multiple version ranges in a spec string.
 
Fields inherited from class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
webServiceObject
 
Constructor Summary
protected VersionSpec(java.lang.Object webServiceObject)
           
 
Method Summary
static VersionSpec fromWebServiceObject(ms.tfs.versioncontrol.clientservices._03._VersionSpec spec)
          Constructs a new VersionSpec-derived class, the type of which is appropriate for the given _VersionSpec instance.
 ms.tfs.versioncontrol.clientservices._03._VersionSpec getWebServiceObject()
          Gets the web service object this class wraps.
static VersionSpec[] parseMultipleVersionsFromSpec(java.lang.String versionSpecs, java.lang.String user, boolean allowVersionRange)
          Parses multiple AVersionSpec instances out of a string containing a version range separator.
static VersionSpec parseSingleVersionFromSpec(java.lang.String spec, java.lang.String user)
          Parses a single version spec string (no ranges allowed) and returns an AVersionSpec object that represents that spec.
abstract  java.lang.String toString()
          Returns the version component of the spec string for the type of VersionSpec implemented by this class.
 
Methods inherited from class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RANGE_DELIMITER

public static final char RANGE_DELIMITER
Separates the (possibly) multiple version ranges in a spec string.

Constant Field Value:
126
See Also:
Constant Field Values
Constructor Detail

VersionSpec

protected VersionSpec(java.lang.Object webServiceObject)
Method Detail

parseMultipleVersionsFromSpec

public static VersionSpec[] parseMultipleVersionsFromSpec(java.lang.String versionSpecs,
                                                          java.lang.String user,
                                                          boolean allowVersionRange)
                                                   throws VersionSpecParseException,
                                                          LabelSpecParseException
Parses multiple AVersionSpec instances out of a string containing a version range separator. If the string contains only one version specificaion, only one AVersionSpec is returned. Deletion identifiers are also parsed and returned.

Parameters:
versionSpecs - the string containing (possibly) multiple version specs, separated by a range separator character.
user - the username to use for the types of version specs that require one.
allowVersionRange - whether to allow version ranges (instead of just one version). If set to false, and a version range is detected, an AVersionSpecParseException is thrown
Returns:
an array of AVersionSpec objects, one for each version spec parsed from the string.
Throws:
VersionSpecParseException - if an error occured parsing a version spec from the string.
LabelSpecParseException - if an error occured parsing a label spec from the string.

parseSingleVersionFromSpec

public static VersionSpec parseSingleVersionFromSpec(java.lang.String spec,
                                                     java.lang.String user)
                                              throws VersionSpecParseException,
                                                     LabelSpecParseException
Parses a single version spec string (no ranges allowed) and returns an AVersionSpec object that represents that spec. Times in the spec string are converted from local time to UTC before being set in the objects. Deletion identifiers are also parsed and returned.

Parameters:
spec - the single spec string to parse (no range delimiter allowed) (must not be null)
user - the username to use to qualify a workspace spec.
Returns:
a new AVersionSpec, appropriate for the spec string.
Throws:
VersionSpecParseException - if an error occurred parsing the spec string.
LabelSpecParseException - if a label spec string was encountered but an error occurred parsing it.

fromWebServiceObject

public static final VersionSpec fromWebServiceObject(ms.tfs.versioncontrol.clientservices._03._VersionSpec spec)
Constructs a new VersionSpec-derived class, the type of which is appropriate for the given _VersionSpec instance.

Parameters:
spec - the version spec instance to use as source.
Returns:
a new VersionSpec-derived class initialized with the given spec.

getWebServiceObject

public ms.tfs.versioncontrol.clientservices._03._VersionSpec getWebServiceObject()
Gets the web service object this class wraps. The returned object should not be modified.

Returns:
the web service object this class wraps.

toString

public abstract java.lang.String toString()
Returns the version component of the spec string for the type of VersionSpec implemented by this class. This is used to format version specs for display to the user.

Overrides:
toString in class com.microsoft.tfs.core.internal.wrappers.WebServiceObjectWrapper
Returns:
the version component of the spec string.


© 2015 Microsoft. All rights reserved.