当前位置: 首页>>代码示例>>Java>>正文


Java RubyHash.keySet方法代码示例

本文整理汇总了Java中org.jruby.RubyHash.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java RubyHash.keySet方法的具体用法?Java RubyHash.keySet怎么用?Java RubyHash.keySet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jruby.RubyHash的用法示例。


在下文中一共展示了RubyHash.keySet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setHashParameters

import org.jruby.RubyHash; //导入方法依赖的package包/类
private void setHashParameters(Transformer transformer, RubyHash hash) {
    Set<String> keys = hash.keySet();
    for (String key : keys) {
        String value = (String)hash.get(key);
        transformer.setParameter(key, unparseValue(value));
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:8,代码来源:XsltStylesheet.java

示例2: toJavaHash

import org.jruby.RubyHash; //导入方法依赖的package包/类
public static Map<?, ?> toJavaHash(RubyHash rubyHash) {
    HashMap<Object, Object> map = new HashMap<Object, Object>();
    Set<?> keySet = rubyHash.keySet();
    for (Object rubyKey : keySet) {
        Object rubyValue = rubyHash.get(rubyKey);
        Object javaKey = toJavaObject(rubyKey);
        Object javaValue = toJavaObject(rubyValue);
        map.put(javaKey, javaValue);
    }
    return map;
}
 
开发者ID:vishnukarthikl,项目名称:calabash-android-java,代码行数:12,代码来源:Utils.java

示例3: toDocuments

import org.jruby.RubyHash; //导入方法依赖的package包/类
@Override
protected LWDocument[] toDocuments(LongWritable key, Text value, Reporter reporter,
                                   Configuration conf) throws IOException {

  Map<String, Object> params = new HashMap<String, Object>();
  params.put(LOG_RUBY_PARAM, value.toString());
  params.put(FILTERS_ARRAY_RUBY_PARAM, filters);

  List<String> toRemoveList = new ArrayList<String>();
  toRemoveList.add(LOG_RUBY_PARAM);
  toRemoveList.add(FILTERS_ARRAY_RUBY_PARAM);
  Object response = executeScript(MATCHER_RUBY_CLASS, params, toRemoveList);

  try {
    RubyHash hash = (RubyHash) response;
    if (response != null) {
      Set<String> keys = hash.keySet();
      LWDocument document = createDocument();
      for (String currentKey : keys) {
        document.addField(currentKey, hash.get(currentKey));
      }

      // Adding the file where this log was taken
      FileSplit fileSplit = (FileSplit) reporter.getInputSplit();
      String originalLogFilePath = fileSplit.getPath().toUri().getPath();
      document.addField(PATH_FIELD_NAME, originalLogFilePath);

      // Adding offset value
      document.addField(BYTE_OFFSET_FIELD_NAME, key.toString());

      // Set ID
      document.setId(originalLogFilePath + "-" + key.toString() + "-" + System.currentTimeMillis());

      return new LWDocument[] {document};
    } else {
      return null;
    }
  } catch (Exception e) {
    log.error("Error: " + e.getMessage());
    throw new RuntimeException("Error executing ruby script");
  }
}
 
开发者ID:lucidworks,项目名称:hadoop-solr,代码行数:43,代码来源:GrokIngestMapper.java


注:本文中的org.jruby.RubyHash.keySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。