|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ptc.windchill.instassm.ReleaseId
public class ReleaseId
A ReleaseId is an assembly name plus set of five numbers
that looks like: assmbly-id.major.minor.servicePack.dsu.build.
Assembly names (or ids) are short strings that match the regular expression:
[a-zA-Z][a-zA-Z0-9]+While they are not constrained in length they should be three or four characters long. Assembly ids should be treated as case-insensitive strings in all comparisons.
The version class is Comparable. Versions are expected be monotonically increasing over time for a given assembly id where each field is compared placing greater significance on the fields to the left. Thus:
wnc.2.0.0.0.0 > wnc.1.0.0.0.0
wnc.1.1.0.0.0 > wnc.1.0.0.0.0
wnc.1.1.1.0.0 > wnc.1.1.0.0.0
wnc.1.1.1.1.0 > wnc.1.1.1.0.0
wnc.1.1.1.1.1 > wnc.1.1.1.1.1
Versions with different assembly ids will always report inequality via the equals method.
However, if the compareTo() methods are used, the assembly ids will be compared lexicographically
and then the version numbers will be compared left-to-right.
Prior to Windchill 6.2 versions were major.minor.dsu.build. ServicePack number was
added during the 6.0 maintenance cycle. Because there was a need to support specification
of service pack level in 6.0 and Version did not have the extra field, the dsu part was encoded
with the service pack number times 1000. So 6.2 service pack 1 DSU 3 would look like 6.2.1003.
Also prior to Windchill 6.2 versions were allowed to be specified with fewer than four numbers.
Doing so would result in a version that only contains the specified numbers. Now five numbers
are required in the string representation of a version. Thus all versions will in string form
will have five fields, with zeros for fields that are not specified. For example, if you create
a version with Version.createFrom("6.2"), the string form of this version will be
6.2.0.0.0.
AssemblyIdResolver is provided to the
createFrom(String,AssemblyResolver) method. The AssemblyIdResolver
will be given an opportunity to determine an alternative assembly id through whatever
means it chooses.
If a five digit number is specified, each field is interpreted verbatim. No decoding will occur.
Whenever possible, code should not manipulate version strings directly. Rather, it should create a Version instance from the String and use the Version instead.
where the element name could be tailored if desired, and the minor, micro, and build attributes weren't required.
Because of the change in version number representation, the XML structure has been changed. Rather than add another attribute for service pack, versions will now be represented in the format:
where the version's string representation is in the number attribute. This has been don't to reduce coupling between version number format and the XML structure, allowing us more room in the future to handle format changes.
The current version class can handle decoding XML Elements in either form. So as long as code that uses XML version represetations always creates a ReleaseId instance from the Element and uses the ReleaseId class rather than directly querying the Element, this code will be isolated from format changes.
1 => wnc.1.0.0.0.0
1.2 => wnc.1.2.0.0.0
1.2.3 => wnc.1.2.0.3.0
1.2.3.4 => wnc.1.2.0.3.4
1.2.3.4.5 => wnc.1.2.3.4.5
1.2.3004 => wnc.1.2.3.4.0
1.2.3004.5 => wnc.1.2.3.4.5
1.2.0.3004.5 => wnc.1.2.0.3004.5
1.2.6.3004.5 => wnc.1.2.6.3004.5
createFrom(java.lang.String),
createFrom(org.w3c.dom.Element)| Nested Class Summary | |
|---|---|
static interface |
com.ptc.windchill.instassm.ReleaseId.AssemblyIdResolver
Produce an assembly id for a release identifier that contains no assembly id. |
| Constructor Summary | |
|---|---|
ReleaseId(String assembly_id,
Integer major,
Integer minor,
Integer service_pack,
Integer dsu,
Integer build)
Constructs a version from all numeric values Supported API: true Extendable: false |
|
ReleaseId(String assembly_id,
int major,
int minor,
int service_pack,
int dsu,
int build)
Supported API: true Extendable: false |
|
| Method Summary | |
|---|---|
int |
compareTo(Object other_)
Compares the argument to this ReleaseId. |
static ReleaseId |
createFrom(String version_string)
Constructs a ReleaseId object from a String. |
boolean |
equals(Object other)
Returns true if the argument is a ReleaseId object and have equal major, minor, dsu, and build levels. |
String |
getAssemblyId()
Returns the assembly identifier. |
int |
getBuild()
Returns the build number. |
int |
getDsu()
Returns the dsu number. |
int |
getMajor()
Returns the major number. |
int |
getMinor()
Returns the minor number. |
String |
getReleaseIdComponent()
Returns the version. |
int |
getServicePack()
Returns the service pack number. |
String |
getShortenedMajorMinorServicePackComponent()
Returns the sortened version which is the concatenation of just the major and minor verison numbers separated by period. |
String |
getShortenedReleaseIdComponent()
Returns the sortened version which is the concatenation of the major, minor, and dsu without the build number separated by periods and stripping any insignificant zeros off of the right-hand portion of the string. |
String |
getThreePartVersionString()
Returns the first three parts of the version number. |
String |
getTwoPartVersionString()
Returns the first two parts of the version number. |
int |
hashCode()
Supported API: true Extendable: false |
String |
toString()
returns a String representation of this ReleaseId. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ReleaseId(String assembly_id,
Integer major,
Integer minor,
Integer service_pack,
Integer dsu,
Integer build)
throws com.ptc.windchill.instassm.ReleaseIdException
assembly_id - Stringmajor - Integerminor - Integerservice_pack - Integerdsu - Integerbuild - Integer
ReleaseIdException
public ReleaseId(String assembly_id,
int major,
int minor,
int service_pack,
int dsu,
int build)
throws com.ptc.windchill.instassm.ReleaseIdException
com.ptc.windchill.instassm.ReleaseIdException| Method Detail |
|---|
public final String getAssemblyId()
public final String getReleaseIdComponent()
public final String getShortenedReleaseIdComponent()
public final String getTwoPartVersionString()
public final String getThreePartVersionString()
public final String getShortenedMajorMinorServicePackComponent()
public final int getMajor()
public final int getMinor()
public final int getServicePack()
public final int getDsu()
public final int getBuild()
public String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Objectother_ - Object should be an instance of ReleaseId or ReleaseId subclass
public int compareTo(Object other_)
compareTo in interface Comparableother_ - Object ReleaseId to be compared with this.
public static final ReleaseId createFrom(String version_string)
throws com.ptc.windchill.instassm.ReleaseIdException
version_string - String Non-null string in any of the acceptable forms(see class javadocs)
ReleaseIdException - if version_string is not in an acceptable form
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||