public final class Convert
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Convert.Lazy
Lazy holder for creating a single instance of
Gson on demand. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
toBoolean(java.lang.Object source)
Find the boolean value of the source
|
static java.lang.String |
toHexString(byte[] source)
Converts the given array of bytes into hexadecimal string.
|
static int |
toInt(java.lang.Object source)
Converts the given object into a primitive integer value.
|
static int |
toInt(java.lang.Object source,
int defaultValue)
Converts the given object into a primitive integer value.
|
static java.lang.String |
toJsonString(java.lang.Object source)
Converts the given object into a JSON formatted string.
|
static <T> java.util.List<T> |
toList(java.util.Set<T> source)
Converts a set of objects into a list of objects.
|
static long |
toLong(java.lang.Object source)
Converts the given object into a primitive long value.
|
static long |
toLong(java.lang.Object source,
long defaultValue)
Converts the given object into a primitive long value.
|
static java.lang.Long[] |
toLongArray(java.util.Collection<? extends java.lang.Number> source)
Converts the give collection of
Number objects into an array of Long objects. |
static java.lang.Long[] |
toLongArray(long[] source)
Converts the give array of primitive long values into an array of
Long values. |
static long[] |
toPrimitiveLongArray(java.util.Collection<? extends java.lang.Number> collection)
Converts the give collection of
Number objects into an array of primitive long values. |
static <T> java.util.Set<T> |
toSet(java.util.Collection<T> source)
Converts the given
Collection of objects into a Set of objects. |
static <T> java.util.Set<T> |
toSet(T[] source)
Converts the given primitive array of objects into a
Set of objects. |
static java.lang.String |
toString(java.lang.Object source)
Converts the given object into a
String object. |
static java.lang.String |
toString(java.lang.Object source,
java.lang.String defaultValue)
Converts the given object into a
String object. |
static java.net.URI |
toURI(java.lang.Object source)
Converts the give object to an
URI object. |
@Nullable
public static java.lang.String toString(@Nullable
java.lang.Object source,
@Nullable
java.lang.String defaultValue)
String object.source - the object to be converted.defaultValue - the value that should be returned if the object cannot be converted.@NonNull
public static java.lang.String toString(@Nullable
java.lang.Object source)
String object.source - the object to be converted.public static boolean toBoolean(@Nullable
java.lang.Object source)
source - the object to be compared.public static long toLong(@Nullable
java.lang.Object source,
long defaultValue)
source - the object to be converted.defaultValue - the value that should be returned if the object cannot be converted.public static long toLong(@Nullable
java.lang.Object source)
source - the object to be converted.public static int toInt(@Nullable
java.lang.Object source,
int defaultValue)
source - the object to be converted.defaultValue - the value that should be returned if the object cannot be converted.public static int toInt(@Nullable
java.lang.Object source)
source - the object to be converted.@NonNull
public static <T> java.util.Set<T> toSet(@Nullable
T[] source)
Set of objects.T - the type of the object.source - the array of objects to be converted.Set containing the objects.@NonNull
public static <T> java.util.List<T> toList(@Nullable
java.util.Set<T> source)
T - source - the set of objects to be converted.@NonNull
public static <T> java.util.Set<T> toSet(@Nullable
java.util.Collection<T> source)
Collection of objects into a Set of objects.T - the type of the object.source - the list of objects to be converted.Set containing the objects.@NonNull
public static long[] toPrimitiveLongArray(@Nullable
java.util.Collection<? extends java.lang.Number> collection)
Number objects into an array of primitive long values.collection - a collection of Number objects@NonNull
public static java.lang.Long[] toLongArray(@Nullable
java.util.Collection<? extends java.lang.Number> source)
Number objects into an array of Long objects.source - a collection of Number objectsLong objects.@NonNull
public static java.lang.Long[] toLongArray(@Nullable
long[] source)
Long values.source - an array of primitive long values.Long objects.@Nullable
public static java.net.URI toURI(@Nullable
java.lang.Object source)
URI object.source - the object to be converted.@NonNull
public static java.lang.String toHexString(@Nullable
byte[] source)
source - an array of bytes.@NonNull
public static java.lang.String toJsonString(@Nullable
java.lang.Object source)
source - the object to be converted.