public class FormatUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
escapeQuotesForCsv(String value)
Escapes quotes in a string for use in a double quoted CSV string
|
static String |
formatException(Throwable e)
Formats an exception as a string for logging purposes
|
static String |
formatInstant(org.joda.time.Instant instant)
Formats an instant using the configured instant formatter
|
static String |
formatNumber(double value)
Formats a double as a string
|
static String |
formatNumber(long value)
Formats an integer as a string
|
static String |
formatResultCount(long resultCount)
Formats the result count taking account of the special values
OperationRun.NOT_YET_RUN or OperationRun.UNKNOWN |
static String |
formatSeconds(double time)
Formats Time to show as seconds
|
static String |
formatSeconds(long time)
Formats Time to show as seconds
|
static String |
formatSecondsSquared(double timeSquared)
Formats Time to show as seconds squared
|
static String |
formatSecondsSquared(long timeSquared)
Formats Time to show as seconds squared
|
static void |
resetInstantFormatter()
Resets the instant formatter to the default which is
dd/MM/yyyy HH:mm:ss Z |
static void |
setInstantFormatter(org.joda.time.format.DateTimeFormatter formatter)
Sets the date time formatter to use
|
static String |
toCsv(String value)
Formats a string for CSV escaping it as a double quoted CSV string if
necessary
|
public static void setInstantFormatter(org.joda.time.format.DateTimeFormatter formatter)
formatter
- Formatterpublic static void resetInstantFormatter()
dd/MM/yyyy HH:mm:ss Z
public static String formatSeconds(long time)
time
- Time in nanosecondspublic static String formatSeconds(double time)
time
- Time in nanosecondspublic static String formatSecondsSquared(long timeSquared)
time
- Time in nanoseconds squaredpublic static String formatSecondsSquared(double timeSquared)
time
- Time in nanoseconds squaredpublic static String formatInstant(org.joda.time.Instant instant)
instant
- Instantpublic static String formatNumber(long value)
value
- Integerpublic static String formatNumber(double value)
value
- Doublepublic static String toCsv(String value)
value
- public static String escapeQuotesForCsv(String value)
value
- public static String formatResultCount(long resultCount)
OperationRun.NOT_YET_RUN
or OperationRun.UNKNOWN
resultCount
- Result CountCopyright © 2015. All rights reserved.