Class FormatUtil
- java.lang.Object
 - 
- org.checkerframework.checker.formatter.util.FormatUtil
 
 
- 
@AnnotatedFor("nullness") public class FormatUtil extends java.lang.Object
This class provides a collection of utilities to ease working with format strings. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFormatUtil.ExcessiveOrMissingFormatArgumentExceptionstatic classFormatUtil.IllegalFormatConversionCategoryException 
- 
Constructor Summary
Constructors Constructor Description FormatUtil() 
- 
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.StringasFormat(java.lang.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(java.lang.String formatSpecifier)Deprecated.This method is public only for testing.static ConversionCategory[]formatParameterCategories(java.lang.String format)Returns aConversionCategoryfor every conversion found in the format string.static voidtryFormatSatisfiability(java.lang.String format)Throws an exception if the format is not syntactically valid. 
 - 
 
- 
- 
Method Detail
- 
asFormat
@ReturnsFormat public static java.lang.String asFormat(java.lang.String format, ConversionCategory... cc) throws java.util.IllegalFormatException
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:
 java.util.IllegalFormatException- if the format string is incompatible with the conversion categories
 
- 
tryFormatSatisfiability
public static void tryFormatSatisfiability(java.lang.String format) throws java.util.IllegalFormatExceptionThrows an exception if the format is not syntactically valid.- Parameters:
 format- a format string- Throws:
 java.util.IllegalFormatException- if the format string is invalid
 
- 
formatParameterCategories
public static ConversionCategory[] formatParameterCategories(java.lang.String format) throws java.util.IllegalFormatException
Returns aConversionCategoryfor every conversion found in the format string.Throws an exception if the format is not syntactically valid.
- Throws:
 java.util.IllegalFormatException
 
- 
conversionCharFromFormat
@Deprecated public static char conversionCharFromFormat(java.lang.String formatSpecifier)
Deprecated.This method is public only for testing. Use private method#conversionCharFromFormat(Matcher).Return 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
 
 
 - 
 
 -