Class VersionCompare


  • public class VersionCompare
    extends java.lang.Object
    VersionCompare compares version strings for plugin files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.Integer maj  
      java.lang.String majString  
      java.lang.Integer min  
      java.lang.String minString  
      java.lang.Integer patch  
      java.lang.String patchString  
      java.lang.String tag  
    • Constructor Summary

      Constructors 
      Constructor Description
      VersionCompare()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean atLeast​(VersionCompare b)
      Return true if this verison is at least as big as the given version
      boolean atMost​(VersionCompare b)
      Return true if this verison is at most as big as the given version
      static int comp​(java.lang.Integer v1, java.lang.String s1, java.lang.Integer v2, java.lang.String s2)
      Compares two version strings and their parsed integer values if available.
      int compareTo​(VersionCompare b)  
      static VersionCompare forString​(java.lang.String value)
      Return a VersionCompare for the string
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • maj

        public java.lang.Integer maj
      • majString

        public java.lang.String majString
      • min

        public java.lang.Integer min
      • minString

        public java.lang.String minString
      • patch

        public java.lang.Integer patch
      • patchString

        public java.lang.String patchString
      • tag

        public java.lang.String tag
    • Constructor Detail

      • VersionCompare

        public VersionCompare()
    • Method Detail

      • comp

        public static int comp​(java.lang.Integer v1,
                               java.lang.String s1,
                               java.lang.Integer v2,
                               java.lang.String s2)
        Compares two version strings and their parsed integer values if available. Returns -1,0 or 1, if value 1 is less than, equal to, or greater than value 2, respectively. Compares integers if both are available, otherwise compares non-integer as less than integer. if no integers are available, comparse strings, and treats null strings as less than non-null strings.
      • atLeast

        public boolean atLeast​(VersionCompare b)
        Return true if this verison is at least as big as the given version
      • atMost

        public boolean atMost​(VersionCompare b)
        Return true if this verison is at most as big as the given version
      • forString

        public static VersionCompare forString​(java.lang.String value)
        Return a VersionCompare for the string
      • toString

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