Advertisement

Hadoop Configuration配置自定义类变量

阅读量:

hadoop1.0.4

在进行Hadoop的MR编程过程中,常常会产生这样的想法:若能在Configuration中配置一个类变量将十分便利。通过查阅Configuration的API文档可以发现,通常set方法用于设定基础数据类型,如整型、字符串或双精度浮点数等。那么是否存在一种方式能够设定自定义类的变量呢?例如setClass方法,确实存在这样的功能。

查阅API:

复制代码
 setClass

    
  
    
 public void setClass(String name,
    
                  Class<?> theClass,
    
                  Class<?> xface)
    
 Set the value of the name property to the name of a theClass implementing the given interface xface. An exception is thrown if theClass does not implement the interface xface.
    
 Parameters:
    
 name - property name.
    
 theClass - property value.

全部评论 (0)

还没有任何评论哟~