Version (IcedTea-Web: NetX )
Keywords: net.sourceforge.jnlp.Version class
Date: 2021-03-21

net.sourceforge.jnlp

## Class Version

- java.lang.Object
- - net.sourceforge.jnlp.Version

- Direct Known Subclasses:
    Version.JreVersion

      public class Version
      extends java.lang.Object

  A JNLP Version string in the form "1.2-3_abc" followed by an optional + (includes all later versions) or * (matches any suffixes on versions). More than one version can be included in a string by separating them with spaces.

  Version strings are divided by "._-" charecters into parts. These parts are compared numerically if they can be parsed as integers or lexographically as strings otherwise. If the number of parts is different between two version strings then the smaller one is padded with zero or the empty string. Note that the padding in this version means that 1.2+ matches 1.4.0-beta1, but may not in future versions.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Version.JreVersion` This is special case of version, used only for checking jre version.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Version(java.lang.String versions)` Create a Version object based on a version string (ie, "1.2.3+ 4.56*").

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `compare(java.lang.String part1, java.lang.String part2)` Compares two parts of a version string, by value if both can be interpreted as integers or lexically otherwise.
    `protected boolean` | `equal(java.util.List<java.lang.String> parts1, java.util.List<java.lang.String> parts2)`
    `protected java.util.List<java.lang.String>` | `getParts(java.lang.String oneVersion)`
    `protected java.util.List<java.lang.String>` | `getVersionStrings()`
    `protected boolean` | `greater(java.util.List<java.lang.String> parts1, java.util.List<java.lang.String> parts2)`
    `boolean` | `isVersionId()`
    `boolean` | `matches(java.lang.String version)`
    `boolean` | `matches(Version version)`
    `boolean` | `matchesAny(java.lang.String version)`
    `boolean` | `matchesAny(Version version)`
    `protected void` | `normalize(java.util.List<java.util.List<java.lang.String>> versions, int maxLength)` Normalize version strings so that they contain the same number of constituent parts.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Version

          public Version(java.lang.String versions)

      Create a Version object based on a version string (ie, "1.2.3+ 4.56*").
      Parameters:
        `versions` - string describing version

  - ### Method Detail

    - #### isVersionId

          public boolean isVersionId()

      Returns:
        true if the version represents a version-id (a single version number such as 1.2) and false otherwise.

    - #### matches

          public boolean matches(java.lang.String version)

      Parameters:
        `version` - a version string
      Returns:
        true if all of this version's version-ids match one or more of the specifed version's version-id.

    - #### matches

          public boolean matches(Version version)

      Parameters:
        `version` - a Version object
      Returns:
        true if all of this version's version-ids match one or more of the specifed version's version-id.

    - #### matchesAny

          public boolean matchesAny(java.lang.String version)

      Parameters:
        `version` - a version string
      Returns:
        true if any of this version's version-ids match one or more of the specifed version's version-id.

    - #### matchesAny

          public boolean matchesAny(Version version)

      Parameters:
        `version` - a Version object
      Returns:
        true if any of this version's version-ids match one or more of the specifed version's version-id.

    - #### equal

          protected boolean equal(java.util.List<java.lang.String> parts1,
                                  java.util.List<java.lang.String> parts2)

      Parameters:
        `parts1` - normalized version parts
        `parts2` - normalized version parts
      Returns:
        whether the parts of one version are equal to the parts of another version.

    - #### greater

          protected boolean greater(java.util.List<java.lang.String> parts1,
                                    java.util.List<java.lang.String> parts2)

      Parameters:
        `parts1` - normalized version parts
        `parts2` - normalized version parts
      Returns:
        whether the parts of one version are greater than the parts of another version.

    - #### compare

          protected int compare(java.lang.String part1,
                                java.lang.String part2)

      Compares two parts of a version string, by value if both can be interpreted as integers or lexically otherwise. If a part is the result of normalization then it can be the Integer zero or an empty string. Returns a value equivalent to part1.compareTo(part2);
      Parameters:
        `part1` - a part of a version string
        `part2` - a part of a version string
      Returns:
        comparison of the two parts

    - #### normalize

          protected void normalize(java.util.List<java.util.List<java.lang.String>> versions,
                                   int maxLength)

      Normalize version strings so that they contain the same number of constituent parts.
      Parameters:
        `versions` - list array of parts of a version string
        `maxLength` - truncate lists to this maximum length

    - #### getVersionStrings

          protected java.util.List<java.lang.String> getVersionStrings()

      Returns:
        the individual version strings that make up a Version.

    - #### getParts

          protected java.util.List<java.lang.String> getParts(java.lang.String oneVersion)

      Parameters:
        `oneVersion` - a single version id string (not compound)
      Returns:
        the constituent parts of a version string.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Submit a bug or feature