public final class Utils extends Object
Modifier and Type | Field and Description |
---|---|
static Boolean[] |
EMPTY_BOOLEAN_OBJECT_ARRAY |
static Byte[] |
EMPTY_BYTE_OBJECT_ARRAY |
static Character[] |
EMPTY_CHARACTER_OBJECT_ARRAY |
static Double[] |
EMPTY_DOUBLE_OBJECT_ARRAY |
static Float[] |
EMPTY_FLOAT_OBJECT_ARRAY |
static Integer[] |
EMPTY_INTEGER_OBJECT_ARRAY |
static Long[] |
EMPTY_LONG_OBJECT_ARRAY |
static Short[] |
EMPTY_SHORT_OBJECT_ARRAY |
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
arrayOf(T[] firstElements,
T lastElement)
Joins the given arguments into one array.
|
static <T> T[] |
arrayOf(T firstElement,
T... moreElements)
Joins the given arguments into one array.
|
static <T> T[] |
arrayOf(T firstElement,
T secondElement,
T... moreElements)
Joins the given arguments into one array.
|
static <T> boolean |
equal(T a,
T b)
Null enabled equals().
|
static Constructor |
findConstructor(Class<?> type,
Object[] args)
Finds the constructor of the given class that is compatible with the given arguments.
|
static Class<?> |
getClass(Type type)
Get the underlying class for a type, or null if the type is a variable type.
|
static List<Class<?>> |
getTypeArguments(Class<?> base,
Class<?> implementation)
Gets the actual type arguments that are used in a given implementation of a given generic base class or interface.
|
static String |
humanize(long value)
Formats the given long value into a human readable notation using the Kilo, Mega, Giga, etc.
|
static Boolean[] |
toObjectArray(boolean[] array) |
static Byte[] |
toObjectArray(byte[] array) |
static Character[] |
toObjectArray(char[] array) |
static Double[] |
toObjectArray(double[] array) |
static Float[] |
toObjectArray(float[] array) |
static Integer[] |
toObjectArray(int[] array) |
static Long[] |
toObjectArray(long[] array) |
static Short[] |
toObjectArray(short[] array) |
static String |
toString(Object obj)
Null enabled toString().
|
public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY
public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY
public static final Long[] EMPTY_LONG_OBJECT_ARRAY
public static final Short[] EMPTY_SHORT_OBJECT_ARRAY
public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY
public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY
public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY
public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY
public static Character[] toObjectArray(char[] array)
public static Integer[] toObjectArray(int[] array)
public static Long[] toObjectArray(long[] array)
public static Short[] toObjectArray(short[] array)
public static Byte[] toObjectArray(byte[] array)
public static Float[] toObjectArray(float[] array)
public static Double[] toObjectArray(double[] array)
public static Boolean[] toObjectArray(boolean[] array)
public static <T> T[] arrayOf(T firstElement, T... moreElements)
firstElement
- the first elementmoreElements
- more elements (optional)public static <T> T[] arrayOf(T firstElement, T secondElement, T... moreElements)
firstElement
- the first elementsecondElement
- the second elementmoreElements
- more elements (optional)public static <T> T[] arrayOf(T[] firstElements, T lastElement)
firstElements
- the first elementslastElement
- the element to appendpublic static String toString(Object obj)
obj
- the objectpublic static <T> boolean equal(T a, T b)
a
- the first objectb
- the second objectpublic static List<Class<?>> getTypeArguments(Class<?> base, Class<?> implementation)
base
- the generic base class or interfaceimplementation
- the type (potentially) implementing the given base class or interfacepublic static Class<?> getClass(Type type)
type
- the typepublic static Constructor findConstructor(Class<?> type, Object[] args)
type
- the class to find the constructor ofargs
- the argumentspublic static String humanize(long value)
value
- the value to formatCopyright © 2015. All rights reserved.