@AnnotatedFor(value="nullness") public class FormatUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FormatUtil.ExcessiveOrMissingFormatArgumentException |
static class |
FormatUtil.IllegalFormatConversionCategoryException |
Constructor and Description |
---|
FormatUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
asFormat(String format,
ConversionCategory... cc)
Returns the first argument if the format string is satisfiable, and if the format's
parameters match the passed
ConversionCategory s. |
static char |
conversionCharFromFormat(String formatSpecifier)
Deprecated.
This method is public only for testing. Use private method
#conversionCharFromFormat(Matcher) . |
static ConversionCategory[] |
formatParameterCategories(String format)
Returns a
ConversionCategory for every conversion found in the format string. |
static void |
tryFormatSatisfiability(String format)
Throws an exception if the format is not syntactically valid.
|
@ReturnsFormat public static String asFormat(String format, ConversionCategory... cc) throws IllegalFormatException
ConversionCategory
s. Otherwise throws an exception.format
- a format stringcc
- an array of conversion categoriesformat
argumentIllegalFormatException
- if the format string is incompatible with the conversion
categoriespublic static void tryFormatSatisfiability(String format) throws IllegalFormatException
format
- a format stringIllegalFormatException
- if the format string is invalidpublic static ConversionCategory[] formatParameterCategories(String format) throws IllegalFormatException
ConversionCategory
for every conversion found in the format string.
Throws an exception if the format is not syntactically valid.
IllegalFormatException
@Deprecated public static char conversionCharFromFormat(String formatSpecifier)
#conversionCharFromFormat(Matcher)
.formatSpecifier
- a format
specifier