Class FoliosFormat

java.lang.Object
net.ixdarklord.folios.api.FoliosFormat

public final class FoliosFormat extends Object
The JSON formats books are written in. A book says which in its book.json, "format_version": "3.0": the Folios version it was written for. A format is numbered by the Folios release that changed the JSON, and a release that changes nothing keeps the format before it, so any Folios version can be named: the newest format at or below it is used ("3.2" reads as 3.0 while the formats are 3.0 and 3.5).

A book without "format_version" was written for Folios 2.x: it is read as format LEGACY, upgraded to the current format as it loads, with a warning in the log.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The format this Folios reads, and writes its upgrades in.
    static final List<String>
    Every format so far, oldest first.
    static final String
    The format of books written for Folios 2.x, and of any book that doesn't say.
    static final String
    The Folios release this is: a book naming a later one needs a newer Folios.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    compare(String first, String second)
    Compares two versions number by number, a missing number counting as 0 ("3" is "3.0").
    static boolean
    isNewer(String version)
    Whether a book naming version was written for a Folios newer than this one.
    static String
    of(String version)
    The format a book naming version is read in: the newest known at or below it, LEGACY below them all.
    static int @Nullable []
    parse(String version)
    A version's numbers ("3.10" is 3 then 10); null when it isn't dot-separated numbers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LEGACY

      public static final String LEGACY
      The format of books written for Folios 2.x, and of any book that doesn't say.
      See Also:
    • CURRENT

      public static final String CURRENT
      The format this Folios reads, and writes its upgrades in.
      See Also:
    • KNOWN

      public static final List<String> KNOWN
      Every format so far, oldest first.
    • RELEASE

      public static final String RELEASE
      The Folios release this is: a book naming a later one needs a newer Folios.
      See Also:
  • Method Details

    • parse

      public static int @Nullable [] parse(String version)
      A version's numbers ("3.10" is 3 then 10); null when it isn't dot-separated numbers.
    • compare

      public static int compare(String first, String second)
      Compares two versions number by number, a missing number counting as 0 ("3" is "3.0").
    • of

      public static String of(String version)
      The format a book naming version is read in: the newest known at or below it, LEGACY below them all.
    • isNewer

      public static boolean isNewer(String version)
      Whether a book naming version was written for a Folios newer than this one.