Class I18nFormatUtil

java.lang.Object
org.checkerframework.checker.i18nformatter.util.I18nFormatUtil

@AnnotatedFor("nullness") public class I18nFormatUtil extends Object
This class provides a collection of utilities to ease working with i18n format strings.
See the Checker Framework Manual:
Internationalization Format String Checker
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory[]
    Returns a I18nConversionCategory for every conversion found in the format string.
    static boolean
    hasFormat(String format, org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory... cc)
    Returns true if the format string is satisfiable, and if the format's parameters match the passed I18nConversionCategorys.
    static boolean
    isFormat(String format)
     
    static void
    Throws an exception if the format is not syntactically valid.

    Methods inherited from class java.lang.Object

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

    • I18nFormatUtil

      public I18nFormatUtil()
  • Method Details

    • tryFormatSatisfiability

      public static void tryFormatSatisfiability(String format) throws IllegalFormatException
      Throws an exception if the format is not syntactically valid.
      Parameters:
      format - the format string to parse
      Throws:
      IllegalFormatException
    • formatParameterCategories

      public static org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory[] formatParameterCategories(String format) throws IllegalFormatException
      Returns a I18nConversionCategory for every conversion found in the format string.
      Parameters:
      format - the format string to parse
      Throws:
      IllegalFormatException - if the format is not syntactically valid
    • hasFormat

      @I18nChecksFormat public static boolean hasFormat(String format, org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory... cc)
      Returns true if the format string is satisfiable, and if the format's parameters match the passed I18nConversionCategorys. Otherwise an error is thrown.
      Parameters:
      format - a format string
      cc - a list of expected categories for the string's format specifiers
      Returns:
      true if the format string's specifiers are the given categories, in order
    • isFormat

      @I18nValidFormat public static boolean isFormat(String format)