public final class Converters
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatBytes(java.lang.Long bytes)
Format the given bytes to nearest 10n with IEC binary unit (KiB, MiB, etc) with rounding precision of
1 fraction.
|
static <K,V> java.util.List<java.util.Map.Entry<K,V>> |
mapToList(java.util.Map<K,V> map)
Converts a
Map<K, V> to a List<Map.Entry<K, V>> . |
static java.lang.String |
printStackTrace(java.lang.Throwable exception)
Print the stack trace of the given exception.
|
static <E> java.util.List<E> |
setToList(java.util.Set<E> set)
Converts a
Set<E> to a List<E> . |
public static java.lang.String formatBytes(java.lang.Long bytes)
Faces.getLocale()
.bytes
- The bytes to be formatted.public static <E> java.util.List<E> setToList(java.util.Set<E> set)
Set<E>
to a List<E>
. Useful when you want to iterate over a
Set
in for example <ui:repeat>
.set
- The set to be converted to list of its entries.public static <K,V> java.util.List<java.util.Map.Entry<K,V>> mapToList(java.util.Map<K,V> map)
Map<K, V>
to a List<Map.Entry<K, V>>
. Useful when you want
to iterate over a Map
in for example <ui:repeat>
. Each of the entries has the
usual getKey()
and getValue()
methods.map
- The map to be converted to list of its entries.public static java.lang.String printStackTrace(java.lang.Throwable exception)
exception
- The exception to print the stack trace for.