FormattableUtils
- @Deprecated public class org.apache.commons.lang3.text.FormattableUtils[source]
Deprecated: As of 3.6, use Apache Commons Text FormattableUtils.
Provides utilities for working with the
Formattableinterface.The
Formattableinterface provides basic control over formatting when using aFormatter. It is primarily concerned with numeric precision and padding, and is not designed to allow generalized alternate formats.- Since:
3.0
Constructors
|
- public FormattableUtils()[source]
FormattableUtilsinstances should NOT be constructed in standard programming. Instead, the methods of the class should be invoked statically.This constructor is public to permit tools that require a JavaBean instance to operate.
Methods
Handles the common |
|
Handles the common |
|
|
Handles the common |
|
Handles the common |
Gets the default formatted representation of the specified |
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width, int precision)[source]
Handles the common
Formattableoperations of truncate-pad-append, with no ellipsis on precision overflow, and padding width underflow with spaces.- Parameters:
seq – The string to handle, not null.
formatter – The destination formatter, not null.
flags – The flags for formatting, see
Formattable.width – The width of the output, see
Formattable.precision – The precision of the output, see
Formattable.
- Returns:
The
formatterinstance, not null.
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width, int precision, char padChar)[source]
Handles the common
Formattableoperations of truncate-pad-append, with no ellipsis on precision overflow.- Parameters:
seq – The string to handle, not null.
formatter – The destination formatter, not null.
flags – The flags for formatting, see
Formattable.width – The width of the output, see
Formattable.precision – The precision of the output, see
Formattable.padChar – The pad character to use.
- Returns:
The
formatterinstance, not null.
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width, int precision, char padChar, CharSequence ellipsis)[source]
Handles the common
Formattableoperations of truncate-pad-append.- Parameters:
seq – The string to handle, not null.
formatter – The destination formatter, not null.
flags – The flags for formatting, see
Formattable.width – The width of the output, see
Formattable.precision – The precision of the output, see
Formattable.padChar – The pad character to use.
ellipsis – The ellipsis to use when precision dictates truncation, null or empty causes a hard truncation.
- Returns:
The
formatterinstance, not null.
- public static Formatter append(CharSequence seq, Formatter formatter, int flags, int width, int precision, CharSequence ellipsis)[source]
Handles the common
Formattableoperations of truncate-pad-append, padding width underflow with spaces.- Parameters:
seq – The string to handle, not null
formatter – The destination formatter, not null.
flags – The flags for formatting, see
Formattable.width – The width of the output, see
Formattable.precision – The precision of the output, see
Formattable.ellipsis – The ellipsis to use when precision dictates truncation, null or empty causes a hard truncation.
- Returns:
The
formatterinstance, not null.
- public static String toString(Formattable formattable)[source]
Gets the default formatted representation of the specified
Formattable.- Parameters:
formattable – The instance to convert to a string, not null.
- Returns:
The resulting string, not null.