Enum FormatChar
- java.lang.Object
-
- java.lang.Enum<FormatChar>
-
- com.google.common.flogger.backend.FormatChar
-
- All Implemented Interfaces:
Serializable,Comparable<FormatChar>
public enum FormatChar extends Enum<FormatChar>
An enum representing the printf-like formatting characters that must be supported by all logging backends. It is important to note that while backends must accept any of these format specifiers, they are not obliged to implement all specified formatting behavior.The default term formatter takes care of supporting all these options when expressed in their normal '%X' form (including flags, width and precision). Custom messages parsers must convert arguments into one of these forms before passing then through to the backend.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOLEANFormats the argument as a boolean.CHARFormats a Unicode code-point.DECIMALFormats the argument as a decimal integer.EXPONENTFormats the argument using computerized scientific notation.EXPONENT_HEXFormats the argument using hexadecimal exponential form.FLOATFormats the argument as a signed decimal floating value.GENERALFormats the argument using general scientific notation.HEXFormats the argument as an unsigned hexadecimal integer.OCTALFormats the argument as an unsigned octal integer.STRINGFormats the argument in a manner specific to the chosen logging backend.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description chargetChar()Returns the lower-case printf style formatting character.StringgetDefaultFormatString()FormatTypegetType()Returns the general format type for this character.static FormatCharof(char c)Returns the FormatChar instance associated with the given printf format specifier.static FormatCharvalueOf(String name)Returns the enum constant of this type with the specified name.static FormatChar[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
STRING
public static final FormatChar STRING
Formats the argument in a manner specific to the chosen logging backend. In many cases this will be equivalent to usingSTRING, but it allows backend implementations to log more structured representations of known types.This is a non-numeric format with an upper-case variant.
-
BOOLEAN
public static final FormatChar BOOLEAN
Formats the argument as a boolean.This is a non-numeric format with an upper-case variant.
-
CHAR
public static final FormatChar CHAR
Formats a Unicode code-point. This formatting rule can be applied to any character or integral numeric value, providing thatCharacter.isValidCodePoint(int)returns true. Note that if the argument cannot be represented losslessly as an integer, it must be considered invalid.This is a non-numeric format with an upper-case variant.
-
DECIMAL
public static final FormatChar DECIMAL
Formats the argument as a decimal integer.This is a numeric format.
-
OCTAL
public static final FormatChar OCTAL
Formats the argument as an unsigned octal integer.This is a numeric format.
'(' is only supported for
BigIntegerorBigDecimal
-
HEX
public static final FormatChar HEX
Formats the argument as an unsigned hexadecimal integer.This is a numeric format with an upper-case variant.
'(' is only supported for
BigIntegerorBigDecimal
-
FLOAT
public static final FormatChar FLOAT
Formats the argument as a signed decimal floating value.This is a numeric format.
-
EXPONENT
public static final FormatChar EXPONENT
Formats the argument using computerized scientific notation.This is a numeric format with an upper-case variant.
-
GENERAL
public static final FormatChar GENERAL
Formats the argument using general scientific notation.This is a numeric format with an upper-case variant.
-
EXPONENT_HEX
public static final FormatChar EXPONENT_HEX
Formats the argument using hexadecimal exponential form. This formatting option is primarily useful when debugging issues with the precise bit-wise representation of doubles because no rounding of the value takes place.This is a numeric format with an upper-case variant.
-
-
Method Detail
-
values
public static FormatChar[] 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 (FormatChar c : FormatChar.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FormatChar 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 nameNullPointerException- if the argument is null
-
of
public static FormatChar of(char c)
Returns the FormatChar instance associated with the given printf format specifier. If the given character is not an ASCII letter, a runtime exception is thrown.
-
getChar
public char getChar()
Returns the lower-case printf style formatting character.Note that as this enumeration is not a subset of any other common formatting syntax, it is not safe to assume that this character can be used to construct a formatting string to pass to other formatting libraries.
-
getType
public FormatType getType()
Returns the general format type for this character.
-
getDefaultFormatString
public String getDefaultFormatString()
-
-