Java Reference
In-Depth Information
<jar href=”...” version=” 2.2.1+ 2.3*” />
Now, we will introduce an implementation of versions as described in the JNLP specification
document, version 1.0.
Our demonstration implementation is composed of seven classes, including one class that
allow for some interactive testing.
Versionable . The abstract superclass.
VersionString . Implements a version string; for example: “ 1.2 1.1+ 1.0.02-final
VersionId . Implements a single version id, such as “ 1.0.2 ”.
PlusVersion . Implements a set of version ids that comprises all the versions greater than
or equal to the specified one; for example: “ 1.2+
StarVersion . Implements a so-called prefix match . In this case, a version id matches one
of these objects when they match their initial subversions, like for example “ 1.2.3 ” and
1.2 ”, which both match the object represented by “ 1.3* ”or“ 1.1.003 ” and “ 1.1* ”.
UnspecifiedVersion . Denotes an unspecified version.
Test . A GUI for interactive version input.
A code similar to this is probably running on your JNLP server implementation. Anyway, if
you are not interested in server-side JNLP implementations, you can skip the following code
and run the Test class to get familiar with version strings in JNLP.
Listing 12.3 shows the Versionable class. This abstract class is the superclass of all version
classes, and includes some general-purpose code such as a factory method (beginning at line
22) for creating the proper object directly from the representing string.
The Versionable Class
package com.marinilli.b2.c12;
* Chapter 12 - abstract class for all the kinds of Version objects
* @author Mauro Marinilli
* @version 1.0
public abstract class Versionable {
* Factory method for <code>Versionable</code> types
Search WWH ::

Custom Search