本文整理了Java中cascading.util.Util.invokeStaticMethod()
方法的一些代码示例,展示了Util.invokeStaticMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.invokeStaticMethod()
方法的具体详情如下:
包路径:cascading.util.Util
类名称:Util
方法名:invokeStaticMethod
暂无
代码示例来源:origin: cwensel/cascading
public static Object invokeStaticMethod( String typeString, String methodName, Object[] parameters, Class[] parameterTypes )
{
Class type = loadClass( typeString );
return invokeStaticMethod( type, methodName, parameters, parameterTypes );
}
代码示例来源:origin: cwensel/cascading
public static String setLog4jLevel( String logger, String level )
{
// removing logj4 dependency
// org.apache.log4j.Logger.getLogger( logger[ 0 ] ).setLevel( org.apache.log4j.Level.toLevel( logger[ 1 ] ) );
Object loggerObject = Util.invokeStaticMethod( "org.apache.log4j.Logger", "getLogger",
new Object[]{logger}, new Class[]{String.class} );
Object levelObject = null;
if( level != null )
levelObject = Util.invokeStaticMethod( "org.apache.log4j.Level", "toLevel",
new Object[]{level}, new Class[]{String.class} );
Object oldLevel = Util.invokeInstanceMethod( loggerObject, "getLevel",
new Object[]{}, new Class[]{} );
Util.invokeInstanceMethod( loggerObject, "setLevel",
new Object[]{levelObject}, new Class[]{Util.loadClass( "org.apache.log4j.Level" )} );
if( oldLevel == null )
return null;
return oldLevel.toString();
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSetLogLevel()
{
Configuration jobConf = new Configuration();
jobConf.set( "log4j.logger", "cascading=DEBUG" );
HadoopUtil.initLog4j( jobConf );
Object loggerObject = Util.invokeStaticMethod( "org.apache.log4j.Logger", "getLogger",
new Object[]{"cascading"}, new Class[]{String.class} );
Object levelObject = Util.invokeStaticMethod( "org.apache.log4j.Level", "toLevel",
new Object[]{"DEBUG"}, new Class[]{String.class} );
Object returnedLevel = Util.invokeInstanceMethod( loggerObject, "getLevel",
new Object[]{}, new Class[]{} );
assertEquals( levelObject, returnedLevel );
}
}
代码示例来源:origin: cascading/cascading-hadoop2-common
@Test
public void testSetLogLevel()
{
Configuration jobConf = new Configuration();
jobConf.set( "log4j.logger", "cascading=DEBUG" );
HadoopUtil.initLog4j( jobConf );
Object loggerObject = Util.invokeStaticMethod( "org.apache.log4j.Logger", "getLogger",
new Object[]{"cascading"}, new Class[]{String.class} );
Object levelObject = Util.invokeStaticMethod( "org.apache.log4j.Level", "toLevel",
new Object[]{"DEBUG"}, new Class[]{String.class} );
Object returnedLevel = Util.invokeInstanceMethod( loggerObject, "getLevel",
new Object[]{}, new Class[]{} );
assertEquals( levelObject, returnedLevel );
}
}
内容来源于网络,如有侵权,请联系作者删除!