2016/09/21 context.getConfiguration().get()

查看api:http://hadoop.apache.org/docs/stable/api/

public String get(String name)
Get the value of the name property, null if no such property exists. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. Values are processed for variable expansion before being returned.
Parameters:
name - the property name, will be trimmed before get value.
Returns:
the value of the name or its replacing property, or null if no such property exists.

若能获取相应的name属性,返回name值,若无法获得,返回null.

 
public String get(String name,
         String defaultValue)
Get the value of the name. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. If no such property exists, then defaultValue is returned.
Parameters:
name - property name, will be trimmed before get value.
defaultValue - default value.
Returns:
property value, or defaultValue if the property doesn't exist.

若能获取相应的name属性,返回name值,若无法获得,返回nulldefaultValue.

 

posted @ 2016-09-21 09:28  张有路  阅读(2160)  评论(0编辑  收藏  举报