Java Code Examples for org.apache.hadoop.conf.Configuration.setDouble()

The following are Jave code examples for showing how to use setDouble() of the org.apache.hadoop.conf.Configuration class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: angel   File: PythonUtils.java   View Source Code Vote up 6 votes
public static Configuration addMapToConf(Map<String, Object> map, Configuration conf) {
  for (String key : map.keySet()) {
    // To-DO: add other ways to justify different value types
    // This is so ugly, must re-implement by more elegance way
    if (map.get(key) instanceof String) {
      conf.set(key, (String) map.get(key));
    } else if (map.get(key) instanceof Integer) {
      conf.setInt(key, (Integer) map.get(key));
    } else if (map.get(key) instanceof Boolean) {
      conf.setBoolean(key, (Boolean) map.get(key));
    } else if (map.get(key) instanceof Float) {
      conf.setFloat(key, (Float) map.get(key));
    } else if (map.get(key) instanceof Double) {
      conf.setDouble(key, (Double) map.get(key));
    } else if (map.get(key) instanceof Long) {
      conf.setLong(key, (Long) map.get(key));
    } else {
      LOG.error("Parse value failed");
    }
  }
  return conf;
}