Package io.jsondb

Class DefaultSchemaVersionComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.String>

    public class DefaultSchemaVersionComparator
    extends java.lang.Object
    implements java.util.Comparator<java.lang.String>
    A default schema version comparator that expects the version to be in x.y.z form where each of the digits is strictly a integer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.String expected, java.lang.String actual)
      compare the expected version with the actual version.
      • Methods inherited from class java.lang.Object

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

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • DefaultSchemaVersionComparator

        public DefaultSchemaVersionComparator()
    • Method Detail

      • compare

        public int compare​(java.lang.String expected,
                           java.lang.String actual)
        compare the expected version with the actual version. Checkout: http://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java
        Specified by:
        compare in interface java.util.Comparator<java.lang.String>
        Parameters:
        expected - the version that is obtained from @Document annotation
        actual - the version that is read from the .json file
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.