public class GetterUtil
extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
BOOLEANS
The String values that can be converted to the
true boolean
value. |
static boolean |
DEFAULT_BOOLEAN
The default boolean value is false.
|
static boolean[] |
DEFAULT_BOOLEAN_VALUES
The default boolean array value is an empty boolean array.
|
static byte |
DEFAULT_BYTE
The default byte value is 0.
|
static byte[] |
DEFAULT_BYTE_VALUES
The default byte array value is an empty byte array.
|
static Date[] |
DEFAULT_DATE_VALUES
The default Date array value is an empty Date array.
|
static double |
DEFAULT_DOUBLE
The default double value is 0.0.
|
static double[] |
DEFAULT_DOUBLE_VALUES
The default double array value is an empty double array.
|
static float |
DEFAULT_FLOAT
The default float value is 0.0f.
|
static float[] |
DEFAULT_FLOAT_VALUES
The default float array value is an empty float array.
|
static int |
DEFAULT_INTEGER
The default integer value is 0.
|
static int[] |
DEFAULT_INTEGER_VALUES
The default integer array value is an empty integer array.
|
static long |
DEFAULT_LONG
The default long value is 0L.
|
static long[] |
DEFAULT_LONG_VALUES
The default long array value is an empty long array.
|
static Number |
DEFAULT_NUMBER
The default Number value is
0 . |
static Number[] |
DEFAULT_NUMBER_VALUES
The default Number array value is an empty Number array.
|
static Number |
DEFAULT_OBJECT
The default Object value is
null . |
static short |
DEFAULT_SHORT
The default short value is 0.
|
static short[] |
DEFAULT_SHORT_VALUES
The default short array value is an empty short array.
|
static String |
DEFAULT_STRING
The default String value is "".
|
static String[] |
DEFAULT_STRING_VALUES
The default String array value is an empty String array.
|
Constructor and Description |
---|
GetterUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
get(Object value,
boolean defaultValue)
Returns the Object value as a boolean.
|
static Date |
get(Object value,
DateFormat dateFormat,
Date defaultValue)
Returns the Object value as a Date.
|
static double |
get(Object value,
double defaultValue)
Returns the Object value as a double.
|
static float |
get(Object value,
float defaultValue)
Returns the Object value as a float.
|
static int |
get(Object value,
int defaultValue)
Returns the Object value as an integer.
|
static long |
get(Object value,
long defaultValue)
Returns the Object value as a long.
|
static Number |
get(Object value,
Number defaultValue)
Returns the Object value as a Number.
|
static short |
get(Object value,
short defaultValue)
Returns the Object value as a short.
|
static String |
get(Object value,
String defaultValue)
Returns the Object value as a String.
|
static boolean |
get(String value,
boolean defaultValue)
Returns the String value as a boolean.
|
static Date |
get(String value,
DateFormat dateFormat,
Date defaultValue)
Returns the String value as a Date.
|
static double |
get(String value,
double defaultValue)
Returns the String value as a double.
|
static double |
get(String value,
double defaultValue,
Locale locale)
Returns the String value as a double.
|
static float |
get(String value,
float defaultValue)
Returns the String value as a float.
|
static int |
get(String value,
int defaultValue)
Returns the String value as an integer.
|
static long |
get(String value,
long defaultValue)
Returns the String value as a long.
|
static short |
get(String value,
short defaultValue)
Returns the String value as a short.
|
static String |
get(String value,
String defaultValue)
Returns the String value as a String.
|
static boolean |
getBoolean(Object value)
Returns the Object value as a boolean.
|
static boolean |
getBoolean(Object value,
boolean defaultValue)
Returns the Object value as a boolean.
|
static boolean |
getBoolean(String value)
Returns the String value as a boolean.
|
static boolean |
getBoolean(String value,
boolean defaultValue)
Returns the String value as a boolean.
|
static boolean[] |
getBooleanValues(Object value)
Returns the Object value as a boolean array.
|
static boolean[] |
getBooleanValues(Object value,
boolean[] defaultValue)
Returns the Object value as a boolean array.
|
static boolean[] |
getBooleanValues(String[] values)
Returns the String values as a boolean array.
|
static boolean[] |
getBooleanValues(String[] values,
boolean[] defaultValue)
Returns the String values as a boolean array.
|
static Date |
getDate(Object value,
DateFormat dateFormat)
Returns the Object value as a Date.
|
static Date |
getDate(Object value,
DateFormat dateFormat,
Date defaultValue)
Returns the Object value as a Date.
|
static Date |
getDate(String value,
DateFormat dateFormat)
Returns the String value as a Date.
|
static Date |
getDate(String value,
DateFormat dateFormat,
Date defaultValue)
Returns the String value as a Date.
|
static Date[] |
getDateValues(Object value,
DateFormat dateFormat)
Returns the Object value as a Date array.
|
static Date[] |
getDateValues(Object value,
DateFormat dateFormat,
Date[] defaultValue)
Returns the Object value as a Date array.
|
static Date[] |
getDateValues(String[] values,
DateFormat dateFormat)
Returns the String value as a Date array.
|
static Date[] |
getDateValues(String[] values,
DateFormat dateFormat,
Date[] defaultValue)
Returns the String value as a Date array.
|
static double |
getDouble(Object value)
Returns the Object value as a double.
|
static double |
getDouble(Object value,
double defaultValue)
Returns the Object value as a double.
|
static double |
getDouble(String value)
Returns the String value as a double.
|
static double |
getDouble(String value,
double defaultValue)
Returns the String value as a double.
|
static double |
getDouble(String value,
Locale locale)
Returns the String value as a double.
|
static double[] |
getDoubleValues(Object value)
Returns the Object value as a double array.
|
static double[] |
getDoubleValues(Object value,
double[] defaultValue)
Returns the Object values as a double array.
|
static double[] |
getDoubleValues(String[] values)
Returns the String values as a double array.
|
static double[] |
getDoubleValues(String[] values,
double[] defaultValue)
Returns the String values as a double array.
|
static float |
getFloat(Object value)
Returns the Object value as a float.
|
static float |
getFloat(Object value,
float defaultValue)
Returns the Object value as a float.
|
static float |
getFloat(String value)
Returns the String value as a float.
|
static float |
getFloat(String value,
float defaultValue)
Returns the String value as a float.
|
static float[] |
getFloatValues(Object value)
Returns the Object value as a float array.
|
static float[] |
getFloatValues(Object value,
float[] defaultValue)
Returns the Object value as a float array.
|
static float[] |
getFloatValues(String[] values)
Returns the String values as a float array.
|
static float[] |
getFloatValues(String[] values,
float[] defaultValue)
Returns the String values as a float array.
|
static int |
getInteger(Object value)
Returns the Object value as an integer.
|
static int |
getInteger(Object value,
int defaultValue)
Returns the Object value as an integer.
|
static int |
getInteger(String value)
Returns the String value as an integer.
|
static int |
getInteger(String value,
int defaultValue)
Returns the String value as an integer.
|
static int |
getIntegerStrict(String value)
Returns the String value as an integer.
|
static int[] |
getIntegerValues(Object value)
Returns the Object value as an integer array.
|
static int[] |
getIntegerValues(Object value,
int[] defaultValue)
Returns the Object value as an integer array.
|
static int[] |
getIntegerValues(String[] values)
Returns the String array values as an integer array.
|
static int[] |
getIntegerValues(String[] values,
int[] defaultValue)
Returns the String array values as an integer array.
|
static long |
getLong(Object value)
Returns the Object value as a long.
|
static long |
getLong(Object value,
long defaultValue)
Returns the Object value as a long.
|
static long |
getLong(String value)
Returns the String value as a long.
|
static long |
getLong(String value,
long defaultValue)
Returns the String value as a long.
|
static long |
getLongStrict(String value)
Returns the String value as a long.
|
static long[] |
getLongValues(Object value)
Returns the Object value as a long array.
|
static long[] |
getLongValues(Object value,
long[] defaultValue)
Returns the Object value as a long array.
|
static long[] |
getLongValues(String[] values)
Returns the String array values as a long array.
|
static long[] |
getLongValues(String[] values,
long[] defaultValue)
Returns the String array values as a long array.
|
static Number |
getNumber(Object value)
Returns the Object value as a Number.
|
static Number |
getNumber(Object value,
Number defaultValue)
Returns the Object value as a Number.
|
static Number |
getNumber(String value)
Returns the String value as a Number.
|
static Number |
getNumber(String value,
Number defaultValue)
Returns the String value as a Number.
|
static Number[] |
getNumberValues(Object value)
Returns the Object value as a Number array.
|
static Number[] |
getNumberValues(Object value,
Number[] defaultValue)
Returns the Object value as a Number array.
|
static Number[] |
getNumberValues(String[] values)
Returns the String array values as a Number array.
|
static Number[] |
getNumberValues(String[] values,
Number[] defaultValue)
Returns the String array values as a Number array.
|
static Object |
getObject(Object value)
Returns the Object value.
|
static Object |
getObject(Object value,
Object defaultValue)
Returns the Object value.
|
static short |
getShort(Object value)
Returns the Object value as a short.
|
static short |
getShort(Object value,
short defaultValue)
Returns the Object value as a short.
|
static short |
getShort(String value)
Returns the String value as a short.
|
static short |
getShort(String value,
short defaultValue)
Returns the String value as a short.
|
static short |
getShortStrict(String value)
Returns the String value as a short.
|
static short[] |
getShortValues(Object value)
Returns the Object value as a short array.
|
static short[] |
getShortValues(Object value,
short[] defaultValue)
Returns the Object value as a short array.
|
static short[] |
getShortValues(String[] values)
Returns the String array values as a short array.
|
static short[] |
getShortValues(String[] values,
short[] defaultValue)
Returns the String array values as a short array.
|
static String |
getString(Object value)
Returns the Object value as a String.
|
static String |
getString(Object value,
String defaultValue)
Returns the Object value as a String.
|
static String |
getString(String value)
Returns the String value.
|
static String |
getString(String value,
String defaultValue)
Returns the String value.
|
static String[] |
getStringValues(Object value)
Returns the Object value as a String array.
|
static String[] |
getStringValues(Object[] values,
String[] defaultValue)
Returns the String array values as a String array.
|
static String[] |
getStringValues(Object[] values,
Supplier<String[]> defaultValueSupplier) |
static String[] |
getStringValues(Object value,
String[] defaultValue)
Returns the Object value as a String array.
|
static String[] |
getStringValues(Object value,
Supplier<String[]> defaultValueSupplier) |
static String[] |
getStringValues(String[] values)
Returns the String array values as a String array.
|
public static final String[] BOOLEANS
true
boolean
value.public static final boolean DEFAULT_BOOLEAN
public static final boolean[] DEFAULT_BOOLEAN_VALUES
public static final byte DEFAULT_BYTE
public static final byte[] DEFAULT_BYTE_VALUES
public static final Date[] DEFAULT_DATE_VALUES
public static final double DEFAULT_DOUBLE
public static final double[] DEFAULT_DOUBLE_VALUES
public static final float DEFAULT_FLOAT
public static final float[] DEFAULT_FLOAT_VALUES
public static final int DEFAULT_INTEGER
public static final int[] DEFAULT_INTEGER_VALUES
public static final long DEFAULT_LONG
public static final long[] DEFAULT_LONG_VALUES
public static final Number DEFAULT_NUMBER
0
.public static final Number[] DEFAULT_NUMBER_VALUES
public static final Number DEFAULT_OBJECT
null
.public static final short DEFAULT_SHORT
public static final short[] DEFAULT_SHORT_VALUES
public static final String DEFAULT_STRING
public static final String[] DEFAULT_STRING_VALUES
public static boolean get(Object value, boolean defaultValue)
null
,
the default value is returned. If the value does not match a BOOLEANS
value, false
is returned.value
- the value to convertdefaultValue
- a default valuepublic static Date get(Object value, DateFormat dateFormat, Date defaultValue)
null
or
not convertible to a Date, the default value is returned.value
- the value to convertdateFormat
- the format used to parse the datedefaultValue
- a default valuepublic static double get(Object value, double defaultValue)
null
or not convertible to a double, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static float get(Object value, float defaultValue)
null
or
not convertible to a float, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static int get(Object value, int defaultValue)
null
or not convertible to an integer, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static long get(Object value, long defaultValue)
null
or
not convertible to a long, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static Number get(Object value, Number defaultValue)
null
or not convertible to a Number, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static short get(Object value, short defaultValue)
null
or
not convertible to a short, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static String get(Object value, String defaultValue)
null
or not convertible to a String, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static boolean get(String value, boolean defaultValue)
null
,
the default value is returned. If the value does not match a BOOLEANS
value, false
is returned.value
- the value to convertdefaultValue
- a default valuepublic static Date get(String value, DateFormat dateFormat, Date defaultValue)
null
or
not convertible to a Date, the default value is returned.value
- the value to convertdateFormat
- the format used to parse the datedefaultValue
- a default valuepublic static double get(String value, double defaultValue)
null
or not convertible to a double, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static double get(String value, double defaultValue, Locale locale)
null
or not convertible to a double, the default value is returned.value
- the value to convertdefaultValue
- a default valuelocale
- the locale used to parse the double valuepublic static float get(String value, float defaultValue)
null
or
not convertible to a float, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static int get(String value, int defaultValue)
null
or not convertible to an integer, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static long get(String value, long defaultValue)
null
or
not convertible to a long, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static short get(String value, short defaultValue)
null
or
not convertible to a short, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static String get(String value, String defaultValue)
null
or not convertible to a String, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static boolean getBoolean(Object value)
null
,
the DEFAULT_BOOLEAN
is returned. If the value does not match a
BOOLEANS
value, false
is returned.value
- the value to convertpublic static boolean getBoolean(Object value, boolean defaultValue)
null
,
the default value is returned. If the value does not match a BOOLEANS
value, false
is returned.value
- the value to convertdefaultValue
- a default valuepublic static boolean getBoolean(String value)
null
,
the DEFAULT_BOOLEAN
is returned. If the value does not match a
BOOLEANS
value, false
is returned.value
- the value to convertpublic static boolean getBoolean(String value, boolean defaultValue)
null
,
the default value is returned. If the value does not match a BOOLEANS
value, false
is returned.value
- the value to convertdefaultValue
- a default valuepublic static boolean[] getBooleanValues(Object value)
null
, the DEFAULT_BOOLEAN_VALUES
array is returned.
In the returned array, each value element that is null
is
replaced by the DEFAULT_BOOLEAN
, and each value element that
does not match a BOOLEANS
value is replaced with
false
.value
- the value to convertpublic static boolean[] getBooleanValues(Object value, boolean[] defaultValue)
null
, the default value is returned. In the returned array,
each value element that is null
is replaced by a default
value, and each value element that does not match a BOOLEANS
value is replaced with false
.value
- the value to convertdefaultValue
- a default valuepublic static boolean[] getBooleanValues(String[] values)
null
, the DEFAULT_BOOLEAN_VALUES
array is returned.
In the returned array, each value element that is null
is
replaced by the DEFAULT_BOOLEAN
, and each value element that
does not match a BOOLEANS
value is replaced with
false
.values
- the values to convertpublic static boolean[] getBooleanValues(String[] values, boolean[] defaultValue)
null
, the default value is returned. In the returned array,
each value element that is null
is replaced by a default
value, and each value element that does not match a BOOLEANS
value is replaced with false
.values
- the values to convertdefaultValue
- a default valuepublic static Date getDate(Object value, DateFormat dateFormat)
null
or
not convertible to a Date, the current date is returned.value
- the value to convertdateFormat
- the format used to parse the datepublic static Date getDate(Object value, DateFormat dateFormat, Date defaultValue)
null
or
not convertible to a Date, the default value is returned.value
- the value to convertdateFormat
- the format used to parse the datedefaultValue
- a default valuepublic static Date getDate(String value, DateFormat dateFormat)
null
or
not convertible to a Date, the current date is returned.value
- the value to convertdateFormat
- the format used to parse the datepublic static Date getDate(String value, DateFormat dateFormat, Date defaultValue)
null
or
not convertible to a Date, the default value is returned.value
- the value to convertdateFormat
- the format used to parse the datedefaultValue
- a default valuepublic static Date[] getDateValues(Object value, DateFormat dateFormat)
null
, the DEFAULT_DATE_VALUES
array is returned. In
the returned array, each value element not convertible to a Date is
replaced by the current date.value
- the value to convertdateFormat
- the format used to parse the datepublic static Date[] getDateValues(Object value, DateFormat dateFormat, Date[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a Date is replaced by the current
date.value
- the value to convertdateFormat
- the format used to parse the datedefaultValue
- a default valuepublic static Date[] getDateValues(String[] values, DateFormat dateFormat)
null
, the DEFAULT_DATE_VALUES
is returned. In the
returned array, each value element not convertible to a Date is replaced
by the current date.values
- the values to convertdateFormat
- the format used to parse the datepublic static Date[] getDateValues(String[] values, DateFormat dateFormat, Date[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a Date is replaced by the current
date.values
- the values to convertdateFormat
- the format used to parse the datedefaultValue
- a default valuepublic static double getDouble(Object value)
null
or not convertible to a double, the DEFAULT_DOUBLE
is returned.value
- the value to convertpublic static double getDouble(Object value, double defaultValue)
null
or not convertible to a double, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static double getDouble(String value)
null
or not convertible to a double, the DEFAULT_DOUBLE
is returned.value
- the value to convertpublic static double getDouble(String value, double defaultValue)
null
or not convertible to a double, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static double getDouble(String value, Locale locale)
null
or not convertible to a double, the DEFAULT_DOUBLE
is returned.value
- the value to convertlocale
- the locale used to parse the double valuepublic static double[] getDoubleValues(Object value)
null
, the default value is returned. In the returned array,
each value element not convertible to a double is replaced by the DEFAULT_DOUBLE
.value
- the value to convertpublic static double[] getDoubleValues(Object value, double[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a double is replaced by the DEFAULT_DOUBLE
.value
- the value to convertdefaultValue
- a default valuepublic static double[] getDoubleValues(String[] values)
null
, the default value is returned. In the returned array,
each value element not convertible to a double is replaced by the DEFAULT_DOUBLE
.values
- the values to convertpublic static double[] getDoubleValues(String[] values, double[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a double is replaced by the default
value.values
- the values to convertdefaultValue
- a default valuepublic static float getFloat(Object value)
null
or
not convertible to a float, the DEFAULT_FLOAT
is returned.value
- the value to convertpublic static float getFloat(Object value, float defaultValue)
null
or
not convertible to a float, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static float getFloat(String value)
null
or
not convertible to a float, the DEFAULT_FLOAT
is returned.value
- the value to convertpublic static float getFloat(String value, float defaultValue)
null
or
not convertible to a float, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static float[] getFloatValues(Object value)
null
, the DEFAULT_FLOAT_VALUES
array is returned.
In the returned array, each value element not convertible to a float is
replaced by the DEFAULT_FLOAT
.value
- the value to convertpublic static float[] getFloatValues(Object value, float[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a float is replaced by the DEFAULT_FLOAT
.value
- the value to convertdefaultValue
- a default valuepublic static float[] getFloatValues(String[] values)
null
, the DEFAULT_FLOAT_VALUES
array is returned.
In the returned array, each value element not convertible to a float is
replaced by the DEFAULT_FLOAT
.values
- the values to convertpublic static float[] getFloatValues(String[] values, float[] defaultValue)
null
, the DEFAULT_FLOAT_VALUES
array is returned.
In the returned array, each value element not convertible to a float is
replaced by the default value.values
- the values to convertdefaultValue
- a default valuepublic static int getInteger(Object value)
null
or not convertible to an integer, the DEFAULT_INTEGER
is
returned.value
- the value to convertpublic static int getInteger(Object value, int defaultValue)
null
or not convertible to an integer, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static int getInteger(String value)
null
or not convertible to an integer, the DEFAULT_INTEGER
is
returned.value
- the value to convertpublic static int getInteger(String value, int defaultValue)
null
or not convertible to an integer, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static int getIntegerStrict(String value)
NumberFormatException
is thrown.value
- the value to convertpublic static int[] getIntegerValues(Object value)
null
, the DEFAULT_INTEGER_VALUES
array is returned.
In the returned array, each value element not convertible to an integer
is replaced by the DEFAULT_INTEGER
.value
- the value to convertpublic static int[] getIntegerValues(Object value, int[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to an integer is replaced by the
DEFAULT_INTEGER
.value
- the value to convertdefaultValue
- a default valuepublic static int[] getIntegerValues(String[] values)
null
, the DEFAULT_INTEGER_VALUES
array is
returned. In the returned array, each value element not convertible to an
integer is replaced by the DEFAULT_INTEGER
.values
- the values to convertpublic static int[] getIntegerValues(String[] values, int[] defaultValue)
null
, the default value is returned. In the returned
array, each value element not convertible to an integer is replaced by
the DEFAULT_INTEGER
.values
- the values to convertdefaultValue
- a default valuepublic static long getLong(Object value)
null
or
not convertible to a long, the DEFAULT_LONG
is returned.value
- the value to convertpublic static long getLong(Object value, long defaultValue)
null
or
not convertible to a long, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static long getLong(String value)
null
or
not convertible to a long, the DEFAULT_LONG
is returned.value
- the value to convertpublic static long getLong(String value, long defaultValue)
null
or
not convertible to a long, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static long getLongStrict(String value)
NumberFormatException
is thrown.value
- the value to convertpublic static long[] getLongValues(Object value)
null
, the DEFAULT_LONG_VALUES
array is returned. In
the returned array, each value element not convertible to a long is
replaced by the DEFAULT_LONG
.value
- the value to convertpublic static long[] getLongValues(Object value, long[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a long is replaced by the DEFAULT_LONG
.value
- the value to convertdefaultValue
- a default valuepublic static long[] getLongValues(String[] values)
null
, the DEFAULT_LONG_VALUES
array is returned. In
the returned array, each value element not convertible to a long is
replaced by the DEFAULT_LONG
.values
- the values to convertpublic static long[] getLongValues(String[] values, long[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a long is replaced by the DEFAULT_LONG
.values
- the values to convertdefaultValue
- a default valuepublic static Number getNumber(Object value)
null
or not convertible to a Number, the DEFAULT_NUMBER
is returned.value
- the value to convertpublic static Number getNumber(Object value, Number defaultValue)
null
or not convertible to a Number, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static Number getNumber(String value)
null
or not convertible to a Number, the DEFAULT_NUMBER
is returned.value
- the value to convertpublic static Number getNumber(String value, Number defaultValue)
null
or not convertible to a Number, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static Number[] getNumberValues(Object value)
null
, the DEFAULT_NUMBER_VALUES
array is returned.
In the returned array, each value element not convertible to a Number is
replaced by the DEFAULT_NUMBER
.value
- the value to convertpublic static Number[] getNumberValues(Object value, Number[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a Number is replaced by the DEFAULT_NUMBER
.value
- the value to convertdefaultValue
- a default valuepublic static Number[] getNumberValues(String[] values)
null
, the DEFAULT_NUMBER_VALUES
array is returned.
In the returned array, each value element not convertible to a Number is
replaced by the DEFAULT_NUMBER
.values
- the values to convertpublic static Number[] getNumberValues(String[] values, Number[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a Number is replaced by the DEFAULT_NUMBER
.values
- the values to convertdefaultValue
- a default valuepublic static Object getObject(Object value)
null
, the DEFAULT_OBJECT
is returned.value
- the valuepublic static Object getObject(Object value, Object defaultValue)
null
, the default
value is returned.value
- the valuedefaultValue
- a default valuepublic static short getShort(Object value)
null
or
not convertible to a short, the DEFAULT_SHORT
is returned.value
- the value to convertpublic static short getShort(Object value, short defaultValue)
null
or
not convertible to a short, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static short getShort(String value)
null
or
not convertible to a short, the DEFAULT_SHORT
is returned.value
- the value to convertpublic static short getShort(String value, short defaultValue)
null
or
not convertible to a short, the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static short getShortStrict(String value)
NumberFormatException
is thrown.value
- the value to convertpublic static short[] getShortValues(Object value)
null
, the DEFAULT_SHORT_VALUES
array is returned.
In the returned array, each value element not convertible to a short is
replaced by the DEFAULT_SHORT
.value
- the value to convertpublic static short[] getShortValues(Object value, short[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a short is replaced by the DEFAULT_SHORT
.value
- the value to convertdefaultValue
- a default valuepublic static short[] getShortValues(String[] values)
null
, the DEFAULT_SHORT_VALUES
array is returned.
In the returned array, each value element not convertible to a short is
replaced by the DEFAULT_SHORT
.values
- the values to convertpublic static short[] getShortValues(String[] values, short[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a short is replaced by the DEFAULT_SHORT
.values
- the values to convertdefaultValue
- a default valuepublic static String getString(Object value)
null
,
the DEFAULT_STRING
is returned.value
- the value to convertpublic static String getString(Object value, String defaultValue)
null
,
the default value is returned.value
- the value to convertdefaultValue
- a default valuepublic static String getString(String value)
null
, the DEFAULT_STRING
is returned.value
- the valuepublic static String getString(String value, String defaultValue)
null
, the default
value is returned.value
- the value to convertdefaultValue
- a default valuepublic static String[] getStringValues(Object value)
null
, the DEFAULT_STRING_VALUES
array is returned.
In the returned array, each value element not convertible to a String is
replaced by the DEFAULT_STRING
.value
- the value to convertpublic static String[] getStringValues(Object value, String[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a String is replaced by the DEFAULT_STRING
.value
- the value to convertdefaultValue
- a default valuepublic static String[] getStringValues(Object value, Supplier<String[]> defaultValueSupplier)
public static String[] getStringValues(Object[] values, String[] defaultValue)
null
, the default value is returned. In the returned array,
each value element not convertible to a String is replaced by the DEFAULT_STRING
.values
- the values to convertdefaultValue
- a default valuepublic static String[] getStringValues(Object[] values, Supplier<String[]> defaultValueSupplier)
public static String[] getStringValues(String[] values)
null
, the default value is returned. In the returned array,
each value element not convertible to a String is replaced by the DEFAULT_STRING
.values
- the values to convert