Class GetterUtil

Object
com.liferay.portal.kernel.util.GetterUtil

public class GetterUtil extends Object
Provides utility methods for reading values as various types.
Author:
Brian Wing Shun Chan
  • Field Details

    • BOOLEANS

      public static final String[] BOOLEANS
      The String values that can be converted to the true boolean value.
    • DEFAULT_BOOLEAN

      public static final boolean DEFAULT_BOOLEAN
      The default boolean value is false.
      See Also:
    • DEFAULT_BOOLEAN_VALUES

      public static final boolean[] DEFAULT_BOOLEAN_VALUES
      The default boolean array value is an empty boolean array.
    • DEFAULT_BYTE

      public static final byte DEFAULT_BYTE
      The default byte value is 0x0.
      See Also:
    • DEFAULT_BYTE_VALUES

      public static final byte[] DEFAULT_BYTE_VALUES
      The default byte array value is an empty byte array.
    • DEFAULT_DATE_VALUES

      public static final Date[] DEFAULT_DATE_VALUES
      The default Date array value is an empty Date array.
    • DEFAULT_DOUBLE

      public static final double DEFAULT_DOUBLE
      The default double value is 0.0.
      See Also:
    • DEFAULT_DOUBLE_VALUES

      public static final double[] DEFAULT_DOUBLE_VALUES
      The default double array value is an empty double array.
    • DEFAULT_FLOAT

      public static final float DEFAULT_FLOAT
      The default float value is 0.0f.
      See Also:
    • DEFAULT_FLOAT_VALUES

      public static final float[] DEFAULT_FLOAT_VALUES
      The default float array value is an empty float array.
    • DEFAULT_INTEGER

      public static final int DEFAULT_INTEGER
      The default integer value is 0.
      See Also:
    • DEFAULT_INTEGER_VALUES

      public static final int[] DEFAULT_INTEGER_VALUES
      The default integer array value is an empty integer array.
    • DEFAULT_LONG

      public static final long DEFAULT_LONG
      The default long value is 0L.
      See Also:
    • DEFAULT_LONG_VALUES

      public static final long[] DEFAULT_LONG_VALUES
      The default long array value is an empty long array.
    • DEFAULT_NUMBER

      public static final Number DEFAULT_NUMBER
      The default Number value is 0.
    • DEFAULT_NUMBER_VALUES

      public static final Number[] DEFAULT_NUMBER_VALUES
      The default Number array value is an empty Number array.
    • DEFAULT_OBJECT

      public static final Number DEFAULT_OBJECT
      The default Object value is null.
    • DEFAULT_SHORT

      public static final short DEFAULT_SHORT
      The default short value is 0.
      See Also:
    • DEFAULT_SHORT_VALUES

      public static final short[] DEFAULT_SHORT_VALUES
      The default short array value is an empty short array.
    • DEFAULT_STRING

      public static final String DEFAULT_STRING
      The default String value is "".
      See Also:
    • DEFAULT_STRING_VALUES

      public static final String[] DEFAULT_STRING_VALUES
      The default String array value is an empty String array.
  • Constructor Details

    • GetterUtil

      public GetterUtil()
  • Method Details

    • get

      public static boolean get(Object value, boolean defaultValue)
      Returns the Object value as a boolean. If the value is null, the default value is returned. If the value does not match a BOOLEANS value, false is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a boolean
    • get

      public static Date get(Object value, DateFormat dateFormat, Date defaultValue)
      Returns the Object value as a Date. If the value is null or not convertible to a Date, the default value is returned.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      defaultValue - a default value
      Returns:
      the value as a Date
    • get

      public static double get(Object value, double defaultValue)
      Returns the Object value as a double. If the value is null or not convertible to a double, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a double
    • get

      public static float get(Object value, float defaultValue)
      Returns the Object value as a float. If the value is null or not convertible to a float, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a float
    • get

      public static int get(Object value, int defaultValue)
      Returns the Object value as an integer. If the value is null or not convertible to an integer, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as an integer
    • get

      public static long get(Object value, long defaultValue)
      Returns the Object value as a long. If the value is null or not convertible to a long, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a long
    • get

      public static Number get(Object value, Number defaultValue)
      Returns the Object value as a Number. If the value is null or not convertible to a Number, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a Number
    • get

      public static short get(Object value, short defaultValue)
      Returns the Object value as a short. If the value is null or not convertible to a short, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a short
    • get

      public static String get(Object value, String defaultValue)
      Returns the Object value as a String. If the value is null or not convertible to a String, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a String
    • get

      public static boolean get(String value, boolean defaultValue)
      Returns the String value as a boolean. If the value is null, the default value is returned. If the value does not match a BOOLEANS value, false is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a boolean
    • get

      public static Date get(String value, DateFormat dateFormat, Date defaultValue)
      Returns the String value as a Date. If the value is null or not convertible to a Date, the default value is returned.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      defaultValue - a default value
      Returns:
      the value as a Date
    • get

      public static double get(String value, double defaultValue)
      Returns the String value as a double. If the value is null or not convertible to a double, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a double
    • get

      public static double get(String value, double defaultValue, Locale locale)
      Returns the String value as a double. If the value is null or not convertible to a double, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      locale - the locale used to parse the double value
      Returns:
      the value as a double
    • get

      public static float get(String value, float defaultValue)
      Returns the String value as a float. If the value is null or not convertible to a float, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a float
    • get

      public static int get(String value, int defaultValue)
      Returns the String value as an integer. If the value is null or not convertible to an integer, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as an integer
    • get

      public static long get(String value, long defaultValue)
      Returns the String value as a long. If the value is null or not convertible to a long, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a long
    • get

      public static short get(String value, short defaultValue)
      Returns the String value as a short. If the value is null or not convertible to a short, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a short
    • get

      public static String get(String value, String defaultValue)
      Returns the String value as a String. If the value is null or not convertible to a String, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a String
    • getBoolean

      public static boolean getBoolean(Object value)
      Returns the Object value as a boolean. If the value is null, the DEFAULT_BOOLEAN is returned. If the value does not match a BOOLEANS value, false is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a boolean
    • getBoolean

      public static boolean getBoolean(Object value, boolean defaultValue)
      Returns the Object value as a boolean. If the value is null, the default value is returned. If the value does not match a BOOLEANS value, false is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a boolean
    • getBoolean

      public static boolean getBoolean(String value)
      Returns the String value as a boolean. If the value is null, the DEFAULT_BOOLEAN is returned. If the value does not match a BOOLEANS value, false is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a boolean
    • getBoolean

      public static boolean getBoolean(String value, boolean defaultValue)
      Returns the String value as a boolean. If the value is null, the default value is returned. If the value does not match a BOOLEANS value, false is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a boolean
    • getBooleanValues

      public static boolean[] getBooleanValues(Object value)
      Returns the Object value as a boolean array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as a boolean array
    • getBooleanValues

      public static boolean[] getBooleanValues(Object value, boolean[] defaultValue)
      Returns the Object value as a boolean array. If the value is 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.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a boolean array
    • getBooleanValues

      public static boolean[] getBooleanValues(String[] values)
      Returns the String values as a boolean array. If the values array is 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.
      Parameters:
      values - the values to convert
      Returns:
      the values as a boolean array
    • getBooleanValues

      public static boolean[] getBooleanValues(String[] values, boolean[] defaultValue)
      Returns the String values as a boolean array. If the values array is 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.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a boolean array
    • getDate

      public static Date getDate(Object value, DateFormat dateFormat)
      Returns the Object value as a Date. If the value is null or not convertible to a Date, the current date is returned.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      Returns:
      the value as a Date
    • getDate

      public static Date getDate(Object value, DateFormat dateFormat, Date defaultValue)
      Returns the Object value as a Date. If the value is null or not convertible to a Date, the default value is returned.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      defaultValue - a default value
      Returns:
      the value as a Date
    • getDate

      public static Date getDate(String value, DateFormat dateFormat)
      Returns the String value as a Date. If the value is null or not convertible to a Date, the current date is returned.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      Returns:
      the value as a Date
    • getDate

      public static Date getDate(String value, DateFormat dateFormat, Date defaultValue)
      Returns the String value as a Date. If the value is null or not convertible to a Date, the default value is returned.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      defaultValue - a default value
      Returns:
      the value as a Date
    • getDateValues

      public static Date[] getDateValues(Object value, DateFormat dateFormat)
      Returns the Object value as a Date array. If the value is 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.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      Returns:
      the value as a Date array
    • getDateValues

      public static Date[] getDateValues(Object value, DateFormat dateFormat, Date[] defaultValue)
      Returns the Object value as a Date array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a Date is replaced by the current date.
      Parameters:
      value - the value to convert
      dateFormat - the format used to parse the date
      defaultValue - a default value
      Returns:
      the value as a Date array
    • getDateValues

      public static Date[] getDateValues(String[] values, DateFormat dateFormat)
      Returns the String value as a Date array. If the values array is 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.
      Parameters:
      values - the values to convert
      dateFormat - the format used to parse the date
      Returns:
      the values as a Date array
    • getDateValues

      public static Date[] getDateValues(String[] values, DateFormat dateFormat, Date[] defaultValue)
      Returns the String value as a Date array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a Date is replaced by the current date.
      Parameters:
      values - the values to convert
      dateFormat - the format used to parse the date
      defaultValue - a default value
      Returns:
      the values as a Date array
    • getDouble

      public static double getDouble(Object value)
      Returns the Object value as a double. If the value is null or not convertible to a double, the DEFAULT_DOUBLE is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a double
    • getDouble

      public static double getDouble(Object value, double defaultValue)
      Returns the Object value as a double. If the value is null or not convertible to a double, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a double
    • getDouble

      public static double getDouble(String value)
      Returns the String value as a double. If the value is null or not convertible to a double, the DEFAULT_DOUBLE is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a double
    • getDouble

      public static double getDouble(String value, double defaultValue)
      Returns the String value as a double. If the value is null or not convertible to a double, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a double
    • getDouble

      public static double getDouble(String value, Locale locale)
      Returns the String value as a double. If the value is null or not convertible to a double, the DEFAULT_DOUBLE is returned.
      Parameters:
      value - the value to convert
      locale - the locale used to parse the double value
      Returns:
      the value as a double
    • getDoubleValues

      public static double[] getDoubleValues(Object value)
      Returns the Object value as a double array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a double is replaced by the DEFAULT_DOUBLE.
      Parameters:
      value - the value to convert
      Returns:
      the value as a double array
    • getDoubleValues

      public static double[] getDoubleValues(Object value, double[] defaultValue)
      Returns the Object values as a double array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a double is replaced by the DEFAULT_DOUBLE.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a double array
    • getDoubleValues

      public static double[] getDoubleValues(String[] values)
      Returns the String values as a double array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a double is replaced by the DEFAULT_DOUBLE.
      Parameters:
      values - the values to convert
      Returns:
      the values as a double array
    • getDoubleValues

      public static double[] getDoubleValues(String[] values, double[] defaultValue)
      Returns the String values as a double array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a double is replaced by the default value.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a double array
    • getFloat

      public static float getFloat(Object value)
      Returns the Object value as a float. If the value is null or not convertible to a float, the DEFAULT_FLOAT is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a float
    • getFloat

      public static float getFloat(Object value, float defaultValue)
      Returns the Object value as a float. If the value is null or not convertible to a float, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a float
    • getFloat

      public static float getFloat(String value)
      Returns the String value as a float. If the value is null or not convertible to a float, the DEFAULT_FLOAT is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a float
    • getFloat

      public static float getFloat(String value, float defaultValue)
      Returns the String value as a float. If the value is null or not convertible to a float, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a float
    • getFloatValues

      public static float[] getFloatValues(Object value)
      Returns the Object value as a float array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as a float array
    • getFloatValues

      public static float[] getFloatValues(Object value, float[] defaultValue)
      Returns the Object value as a float array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a float is replaced by the DEFAULT_FLOAT.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a float array
    • getFloatValues

      public static float[] getFloatValues(String[] values)
      Returns the String values as a float array. If the values array is 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.
      Parameters:
      values - the values to convert
      Returns:
      the values as a float array
    • getFloatValues

      public static float[] getFloatValues(String[] values, float[] defaultValue)
      Returns the String values as a float array. If the values array is 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.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a float array
    • getInteger

      public static int getInteger(Object value)
      Returns the Object value as an integer. If the value is null or not convertible to an integer, the DEFAULT_INTEGER is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as an integer
    • getInteger

      public static int getInteger(Object value, int defaultValue)
      Returns the Object value as an integer. If the value is null or not convertible to an integer, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as an integer
    • getInteger

      public static int getInteger(String value)
      Returns the String value as an integer. If the value is null or not convertible to an integer, the DEFAULT_INTEGER is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as an integer
    • getInteger

      public static int getInteger(String value, int defaultValue)
      Returns the String value as an integer. If the value is null or not convertible to an integer, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as an integer
    • getIntegerStrict

      public static int getIntegerStrict(String value)
      Returns the String value as an integer. If the value is not convertible to an integer, a NumberFormatException is thrown.
      Parameters:
      value - the value to convert
      Returns:
      the value as an integer
    • getIntegerValues

      public static int[] getIntegerValues(Object value)
      Returns the Object value as an integer array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as an integer array
    • getIntegerValues

      public static int[] getIntegerValues(Object value, int[] defaultValue)
      Returns the Object value as an integer array. If the value is null, the default value is returned. In the returned array, each value element not convertible to an integer is replaced by the DEFAULT_INTEGER.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as an integer array
    • getIntegerValues

      public static int[] getIntegerValues(String[] values)
      Returns the String array values as an integer array. If the values array is 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.
      Parameters:
      values - the values to convert
      Returns:
      the values as an integer array
    • getIntegerValues

      public static int[] getIntegerValues(String[] values, int[] defaultValue)
      Returns the String array values as an integer array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to an integer is replaced by the DEFAULT_INTEGER.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as an integer array
    • getLong

      public static long getLong(Object value)
      Returns the Object value as a long. If the value is null or not convertible to a long, the DEFAULT_LONG is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a long
    • getLong

      public static long getLong(Object value, long defaultValue)
      Returns the Object value as a long. If the value is null or not convertible to a long, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a long
    • getLong

      public static long getLong(String value)
      Returns the String value as a long. If the value is null or not convertible to a long, the DEFAULT_LONG is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a long
    • getLong

      public static long getLong(String value, long defaultValue)
      Returns the String value as a long. If the value is null or not convertible to a long, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a long
    • getLongStrict

      public static long getLongStrict(String value)
      Returns the String value as a long. If the value is not convertible to a long, a NumberFormatException is thrown.
      Parameters:
      value - the value to convert
      Returns:
      the value as an long
    • getLongValues

      public static long[] getLongValues(Object value)
      Returns the Object value as a long array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as a long array
    • getLongValues

      public static long[] getLongValues(Object value, long[] defaultValue)
      Returns the Object value as a long array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a long is replaced by the DEFAULT_LONG.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a long array
    • getLongValues

      public static long[] getLongValues(String[] values)
      Returns the String array values as a long array. If the values array is 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.
      Parameters:
      values - the values to convert
      Returns:
      the values as a long array
    • getLongValues

      public static long[] getLongValues(String[] values, long[] defaultValue)
      Returns the String array values as a long array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a long is replaced by the DEFAULT_LONG.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a long array
    • getNumber

      public static Number getNumber(Object value)
      Returns the Object value as a Number. If the value is null or not convertible to a Number, the DEFAULT_NUMBER is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a Number
    • getNumber

      public static Number getNumber(Object value, Number defaultValue)
      Returns the Object value as a Number. If the value is null or not convertible to a Number, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a Number
    • getNumber

      public static Number getNumber(String value)
      Returns the String value as a Number. If the value is null or not convertible to a Number, the DEFAULT_NUMBER is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a Number
    • getNumber

      public static Number getNumber(String value, Number defaultValue)
      Returns the String value as a Number. If the value is null or not convertible to a Number, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a Number
    • getNumberValues

      public static Number[] getNumberValues(Object value)
      Returns the Object value as a Number array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as a Number array
    • getNumberValues

      public static Number[] getNumberValues(Object value, Number[] defaultValue)
      Returns the Object value as a Number array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a Number is replaced by the DEFAULT_NUMBER.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a Number array
    • getNumberValues

      public static Number[] getNumberValues(String[] values)
      Returns the String array values as a Number array. If the values array is 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.
      Parameters:
      values - the values to convert
      Returns:
      the values as a Number array
    • getNumberValues

      public static Number[] getNumberValues(String[] values, Number[] defaultValue)
      Returns the String array values as a Number array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a Number is replaced by the DEFAULT_NUMBER.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a Number array
    • getObject

      public static Object getObject(Object value)
      Returns the Object value. If the value is null, the DEFAULT_OBJECT is returned.
      Parameters:
      value - the value
      Returns:
      the value
    • getObject

      public static Object getObject(Object value, Object defaultValue)
      Returns the Object value. If the value is null, the default value is returned.
      Parameters:
      value - the value
      defaultValue - a default value
      Returns:
      the value
    • getShort

      public static short getShort(Object value)
      Returns the Object value as a short. If the value is null or not convertible to a short, the DEFAULT_SHORT is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a short
    • getShort

      public static short getShort(Object value, short defaultValue)
      Returns the Object value as a short. If the value is null or not convertible to a short, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a short
    • getShort

      public static short getShort(String value)
      Returns the String value as a short. If the value is null or not convertible to a short, the DEFAULT_SHORT is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a short
    • getShort

      public static short getShort(String value, short defaultValue)
      Returns the String value as a short. If the value is null or not convertible to a short, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a short
    • getShortStrict

      public static short getShortStrict(String value)
      Returns the String value as a short. If the value is not convertible to a short, a NumberFormatException is thrown.
      Parameters:
      value - the value to convert
      Returns:
      the value as a short
    • getShortValues

      public static short[] getShortValues(Object value)
      Returns the Object value as a short array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as a short array
    • getShortValues

      public static short[] getShortValues(Object value, short[] defaultValue)
      Returns the Object value as a short array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a short is replaced by the DEFAULT_SHORT.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a short array
    • getShortValues

      public static short[] getShortValues(String[] values)
      Returns the String array values as a short array. If the values array is 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.
      Parameters:
      values - the values to convert
      Returns:
      the values as a short array
    • getShortValues

      public static short[] getShortValues(String[] values, short[] defaultValue)
      Returns the String array values as a short array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a short is replaced by the DEFAULT_SHORT.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a short array
    • getString

      public static String getString(Object value)
      Returns the Object value as a String. If the value is null, the DEFAULT_STRING is returned.
      Parameters:
      value - the value to convert
      Returns:
      the value as a String
    • getString

      public static String getString(Object value, String defaultValue)
      Returns the Object value as a String. If the value is null, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a String
    • getString

      public static String getString(String value)
      Returns the String value. If the value is null, the DEFAULT_STRING is returned.
      Parameters:
      value - the value
      Returns:
      the value
    • getString

      public static String getString(String value, String defaultValue)
      Returns the String value. If the value is null, the default value is returned.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value
    • getStringValues

      public static String[] getStringValues(Object value)
      Returns the Object value as a String array. If the value is 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.
      Parameters:
      value - the value to convert
      Returns:
      the value as a String array
    • getStringValues

      public static String[] getStringValues(Object value, String[] defaultValue)
      Returns the Object value as a String array. If the value is null, the default value is returned. In the returned array, each value element not convertible to a String is replaced by the DEFAULT_STRING.
      Parameters:
      value - the value to convert
      defaultValue - a default value
      Returns:
      the value as a String array
    • getStringValues

      public static String[] getStringValues(Object value, Supplier<String[]> defaultValueSupplier)
    • getStringValues

      public static String[] getStringValues(Object[] values, String[] defaultValue)
      Returns the String array values as a String array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a String is replaced by the DEFAULT_STRING.
      Parameters:
      values - the values to convert
      defaultValue - a default value
      Returns:
      the values as a String array
    • getStringValues

      public static String[] getStringValues(Object[] values, Supplier<String[]> defaultValueSupplier)
    • getStringValues

      public static String[] getStringValues(String[] values)
      Returns the String array values as a String array. If the values array is null, the default value is returned. In the returned array, each value element not convertible to a String is replaced by the DEFAULT_STRING.
      Parameters:
      values - the values to convert
      Returns:
      the values as a String array