Class FormatUtil
java.lang.Object
org.checkerframework.checker.formatter.util.FormatUtil
This class provides a collection of utilities to ease working with format strings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasFormat(String format, ConversionCategory... cc) Returns the first argument if the format string is satisfiable, and if the format's parameters match the passedConversionCategorys.static charconversionCharFromFormat(String formatSpecifier) Deprecated.This method is public only for testing.static ConversionCategory[]formatParameterCategories(String format) Returns aConversionCategoryfor every conversion found in the format string.static voidtryFormatSatisfiability(String format) Throws an exception if the format is not syntactically valid.
-
Method Details
-
asFormat
Returns the first argument if the format string is satisfiable, and if the format's parameters match the passedConversionCategorys. Otherwise throws an exception.- Parameters:
format- a format stringcc- an array of conversion categories- Returns:
- the
formatargument - Throws:
IllegalFormatException- if the format string is incompatible with the conversion categories
-
tryFormatSatisfiability
Throws an exception if the format is not syntactically valid.- Parameters:
format- a format string- Throws:
IllegalFormatException- if the format string is invalid
-
formatParameterCategories
Returns aConversionCategoryfor every conversion found in the format string.- Parameters:
format- a format string- Returns:
- the conversion categories in the format string
- Throws:
IllegalFormatException- if the format is not syntactically valid
-
conversionCharFromFormat
Deprecated.This method is public only for testing. Use private method#conversionCharFromFormat(Matcher).Returns the conversion character that is in the given format specifier.- Parameters:
formatSpecifier- a format specifier- Returns:
- the conversion character that is in the given format specifier
-