Class PluginVersion

  • All Implemented Interfaces:
    java.lang.Comparable<PluginVersion>

    public class PluginVersion
    extends java.lang.Object
    implements java.lang.Comparable<PluginVersion>
    Compares versions. Immutable. A version is a string such as "1.0.0", i.e. a dot separated list of integers. non-integer components are not supported.
    • Method Detail

      • setAcceptSnapshots

        public static void setAcceptSnapshots​(boolean acceptSnapshots)
        Allows parsing to accept snapshots. False by default. This is a global (static) property. Not thread-safe. Must be at program startup. When allowed, 1.0.0 and 1.0.0 are considered identical. When not allowed, snapshot parsing will fail with a runtime Exception
        Parameters:
        acceptSnapshots - true to enable parsing with snapshots
      • components

        public java.util.List<java.lang.Integer> components()
        Returns a copy of the components
        Returns:
        an integer ordered list
      • compareTo

        public int compareTo​(PluginVersion o)
        Specified by:
        compareTo in interface java.lang.Comparable<PluginVersion>
      • of

        public static PluginVersion of​(java.lang.String version)
        Parses and creates a PluginVersion from a version string. Might throw a RuntimeException if parsing fails (bad format).
        Parameters:
        version - the source string
        Returns:
        a PluginVersion instance or null if the source is null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object