public String getString(String key, String defaultValue) { String value = getString(key); if (value != null) { return value; } else { return defaultValue; } }
public float getFloat(String key, float defaultValue) { String value = getString(key); if (value != null) { try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to float", e); } } else { return defaultValue; } }
public float getFloat(String key, float defaultValue) { String value = getString(key); if (value != null) { try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to float", e); } } else { return defaultValue; } }
public int getInteger(String key, int defaultValue) { String value = getString(key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to int", e); } } else { return defaultValue; } }
public double getDouble(String key, double defaultValue) { String value = getString(key); if (value != null) { try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to double", e); } } else { return defaultValue; } }
public int getInteger(String key, int defaultValue) { String value = getString(key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to int", e); } } else { return defaultValue; } }
public long getLong(String key, long defaultValue) { String value = getString(key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to long", e); } } else { return defaultValue; } }
public byte getByte(String key, byte defaultValue) { String value = getString(key); if (value != null) { try { return Byte.parseByte(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to byte", e); } } else { return defaultValue; } }
public float getFloat(String key) { String value = getString(key); if (value != null) { try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to float", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public boolean getBoolean(String key) { String value = getString(key); if (value != null) { try { return Boolean.parseBoolean(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to boolean", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public long getLong(String key) { String value = getString(key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to long", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public short getShort(String key, short defaultValue) { String value = getString(key); if (value != null) { try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to short", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public BigDecimal getBigDecimal(String key, BigDecimal defaultValue) { String value = getString(key); if (value != null) { try { return BigDecimal.valueOf(Double.parseDouble(value)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to BigDecimal", e); } } else { return defaultValue; } }
public short getShort(String key, short defaultValue) { String value = getString(key); if (value != null) { try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to short", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public boolean getBoolean(String key) { String value = getString(key); if (value != null) { try { return Boolean.parseBoolean(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to boolean", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public long getLong(String key) { String value = getString(key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to long", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public float getFloat(String key) { String value = getString(key); if (value != null) { try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to float", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public BigDecimal getBigDecimal(String key) { String value = getString(key); if (value != null) { try { return BigDecimal.valueOf(Double.parseDouble(value)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to BigDecimal", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public BigInteger getBigInteger(String key) { String value = getString(key); if (value != null) { try { return BigInteger.valueOf(Long.parseLong(value)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to BigInteger", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }
public BigInteger getBigInteger(String key) { String value = getString(key); if (value != null) { try { return BigInteger.valueOf(Long.parseLong(value)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] can't be parsed to BigInteger", e); } } else { throw new IllegalArgumentException("Value [" + value + "] for key [" + key + "] is null"); } }