Class VersionSpecification

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<VersionSpecification>
    Direct Known Subclasses:
    ThreeDigitVersionSpecification

    public abstract class VersionSpecification
    extends java.lang.Object
    implements java.lang.Comparable<VersionSpecification>, java.io.Serializable
    Abstract base class for version specifications.

    The most important thing for a version specification is that it can be compared to another one.

    Versions can be specified in two formats : a simple 3-digit spec (+ qualifiers) or a code/tag (not yet ;-) ).

    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    ErwinDL
    See Also:
    Serialized Form
    Pt.AcceptedRating:
    Yellow (ErwinDL)
    Pt.ProposedRating:
    Yellow (ErwinDL)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String _versionString
      The version string.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static VersionSpecification parse​(java.lang.String version)
      Parses the given version String, using '.' , '-' , '_' as potential delimiters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Comparable

        compareTo
    • Field Detail

      • _versionString

        protected java.lang.String _versionString
        The version string.
    • Constructor Detail

      • VersionSpecification

        public VersionSpecification()
    • Method Detail

      • parse

        public static VersionSpecification parse​(java.lang.String version)
        Parses the given version String, using '.' , '-' , '_' as potential delimiters.

        For 3-digit version spec, currently the only supported format, the first 3 version ids are mandatory and should be integer numbers. Extra (optional) trailing ids can be textual. Spaces are not allowed in a version string. E.g. "1.2_3-hello.world" is a valid version identifier.

        Parameters:
        version - The version
        Returns:
        the version specification based on the passed string representation
        Throws:
        java.lang.IllegalArgumentException - when the overall string format is not valid
        java.lang.NumberFormatException - if one of the first 3 segments is not an integer