本文整理汇总了Java中org.jruby.javasupport.JavaEmbedUtils.newRuntimeAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java JavaEmbedUtils.newRuntimeAdapter方法的具体用法?Java JavaEmbedUtils.newRuntimeAdapter怎么用?Java JavaEmbedUtils.newRuntimeAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.javasupport.JavaEmbedUtils
的用法示例。
在下文中一共展示了JavaEmbedUtils.newRuntimeAdapter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import org.jruby.javasupport.JavaEmbedUtils; //导入方法依赖的package包/类
@Override
public void map(LongWritable key, Text value,
OutputCollector<Text, Text> outputCollector, Reporter arg3) throws IOException {
Ruby runtime = Ruby.getGlobalRuntime();
RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
IRubyObject receiver = adapter.eval(runtime, mapper_code);
IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
IRubyObject rubyValue = JavaUtil.convertJavaToRuby(runtime, value);
MapleRoadCollector collector =
new MapleRoadCollector(keyText, valueText, outputCollector);
IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
Helpers.invoke(runtime.getCurrentContext(), receiver, "map", rubyKey, rubyValue, rubyCollector);
}
示例2: reduce
import org.jruby.javasupport.JavaEmbedUtils; //导入方法依赖的package包/类
@Override
public void reduce(Text key, Iterator<IntWritable> values,
OutputCollector<Text, IntWritable> outputCollector, Reporter arg3) throws IOException {;
Ruby runtime = Ruby.getGlobalRuntime();
RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
IRubyObject receiver = adapter.eval(runtime, reducer_code);
IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
IRubyObject rubyValues = JavaUtil.convertJavaToRuby(runtime, values);
MapleRoadCollectorTextInt collector =
new MapleRoadCollectorTextInt(keyText, valueInt, outputCollector);
IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
Helpers.invoke(runtime.getCurrentContext(), receiver, "reduce", rubyKey, rubyValues, rubyCollector);
}
示例3: map
import org.jruby.javasupport.JavaEmbedUtils; //导入方法依赖的package包/类
@Override
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> outputCollector, Reporter arg3) throws IOException {
Ruby runtime = Ruby.getGlobalRuntime();
RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
IRubyObject receiver = adapter.eval(runtime, mapper_code);
IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
IRubyObject rubyValue = JavaUtil.convertJavaToRuby(runtime, value);
MapleRoadCollectorTextInt collector =
new MapleRoadCollectorTextInt(keyText, valueInt, outputCollector);
IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
Helpers.invoke(runtime.getCurrentContext(), receiver, "map", rubyKey, rubyValue, rubyCollector);
}
示例4: reduce
import org.jruby.javasupport.JavaEmbedUtils; //导入方法依赖的package包/类
@Override
public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, Text> outputCollector, Reporter arg3) throws IOException {;
Ruby runtime = Ruby.getGlobalRuntime();
RubyRuntimeAdapter adapter = JavaEmbedUtils.newRuntimeAdapter();
IRubyObject receiver = adapter.eval(runtime, reducer_code);
IRubyObject rubyKey = JavaUtil.convertJavaToRuby(runtime, key);
IRubyObject rubyValues = JavaUtil.convertJavaToRuby(runtime, values);
MapleRoadCollector collector =
new MapleRoadCollector(keyText, valueText, outputCollector);
IRubyObject rubyCollector = JavaUtil.convertJavaToRuby(runtime, collector);
Helpers.invoke(runtime.getCurrentContext(), receiver, "reduce", rubyKey, rubyValues, rubyCollector);
}
示例5: JRubyAsciidoctorModuleFactory
import org.jruby.javasupport.JavaEmbedUtils; //导入方法依赖的package包/类
public JRubyAsciidoctorModuleFactory(Ruby runtime) {
this.runtime = runtime;
this.evaler = JavaEmbedUtils.newRuntimeAdapter();
}