hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan van der Lugt (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HADOOP-8415) getDouble() and setDouble() in org.apache.hadoop.conf.Configuration
Date Sat, 19 May 2012 05:12:18 GMT
Jan van der Lugt created HADOOP-8415:
----------------------------------------

             Summary: getDouble() and setDouble() in org.apache.hadoop.conf.Configuration
                 Key: HADOOP-8415
                 URL: https://issues.apache.org/jira/browse/HADOOP-8415
             Project: Hadoop Common
          Issue Type: Improvement
          Components: conf
    Affects Versions: 1.0.2
            Reporter: Jan van der Lugt
            Priority: Minor


In the org.apache.hadoop.conf.Configuration class, methods exist to set Integers, Longs, Booleans,
Floats and Strings, but methods for Doubles are absent. Are they not there for a reason or
should they be added? In the latter case, these are the missing functions:

  /** 
   * Get the value of the <code>name</code> property as a <code>double</code>.
 
   * If no such property exists, the provided default value is returned,
   * or if the specified value is not a valid <code>double</code>,
   * then an error is thrown.
   *
   * @param name property name.
   * @param defaultValue default value.
   * @throws NumberFormatException when the value is invalid
   * @return property value as a <code>double</code>, 
   *         or <code>defaultValue</code>. 
   */
  public double getDouble(String name, double defaultValue) {
    String valueString = getTrimmed(name);
    if (valueString == null)
      return defaultValue;
    return Double.parseDouble(valueString);
  }
  /**
   * Set the value of the <code>name</code> property to a <code>double</code>.
   * 
   * @param name property name.
   * @param value property value.
   */
  public void setDouble(String name, double value) {
    set(name,Double.toString(value));
  }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message