Enum Draft

  • All Implemented Interfaces:
    Serializable, Comparable<Draft>

    public enum Draft
    extends Enum<Draft>
    Json-Schema drafts. The enum does not explicitly define all known drafts but a selection of the most widely used ones and supported in the implementation.
    Author:
    Paulo Lopes
    • Method Detail

      • values

        public static Draft[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Draft c : Draft.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Draft valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getIdentifier

        public String getIdentifier()
        Returns:
        the identifier of the draft version.
      • from

        public static Draft from​(String string)
        Converts a draft number to a Draft enum value.
        Parameters:
        string - A draft number, e.g.: [4|7|8|2019-09|2020-12]
        Returns:
        a Draft enum value
      • fromIdentifier

        public static Draft fromIdentifier​(String string)
        Converts a draft identifier to a Draft enum value.
        Parameters:
        string - The identifier (in URL format)
        Returns:
        a Draft enum value
      • isAfter

        public boolean isAfter​(Draft draft)
        Parameters:
        draft - to check against
        Returns:
        true if the draft instance was released after the draft provided.
      • isBefore

        public boolean isBefore​(Draft draft)
        Parameters:
        draft - to check against
        Returns:
        true if the draft instance was released before the draft provided.