コード例 #1
0
  public Short getShort(String key, Short defaultValue) {
    String value = getProperty(key);

    if (value == null) {
      return defaultValue;
    } else {
      try {
        return PropertyConverter.toShort(interpolate(value));
      } catch (ConversionException e) {
        throw new ConversionException('\'' + key + "' doesn't map to a Short object", e);
      }
    }
  }
コード例 #2
0
  public Double getDouble(String key, Double defaultValue) {
    String value = getProperty(key);

    if (value == null) {
      return defaultValue;
    } else {
      try {
        return PropertyConverter.toDouble(interpolate(value));
      } catch (ConversionException e) {
        throw new ConversionException('\'' + key + "' doesn't map to a Double object", e);
      }
    }
  }
コード例 #3
0
  public Integer getInteger(String key, Integer defaultValue) {
    String value = getProperty(key);

    if (value == null) {
      return defaultValue;
    } else {
      try {
        return PropertyConverter.toInteger(interpolate(value));
      } catch (ConversionException e) {
        throw new ConversionException('\'' + key + "' doesn't map to an Integer object", e);
      }
    }
  }
コード例 #4
0
  public Boolean getBoolean(String key, Boolean defaultValue) {
    String value = getProperty(key);

    if (value == null) {
      return defaultValue;
    } else {
      try {
        return PropertyConverter.toBoolean(interpolate(value));
      } catch (ConversionException e) {
        throw new ConversionException('\'' + key + "' doesn't map to a Boolean object", e);
      }
    }
  }