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


Java XContentMapValues.isArray方法代码示例

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


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

示例1: buildArrayFromSettings

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
/**
 * Extract array from settings (array or ; delimited String)
 * @param settings Settings
 * @param path Path to settings definition
 * @return Array of settings
 */
@SuppressWarnings("unchecked")
public static String[] buildArrayFromSettings(Map<String, Object> settings, String path){
   String[] includes;

   // We manage comma separated format and arrays
   if (XContentMapValues.isArray(XContentMapValues.extractValue(path, settings))) {
      List<String> includesarray = (List<String>) XContentMapValues.extractValue(path, settings);
      int i = 0;
      includes = new String[includesarray.size()];
      for (String include : includesarray) {
         includes[i++] = trimAllWhitespace(include);
      }
   } else {
      String includedef = (String) XContentMapValues.extractValue(path, settings);
      includes = Strings.commaDelimitedListToStringArray(trimAllWhitespace(includedef));
   }
   
   String[] uniquelist = removeDuplicateStrings(includes);
   
   return uniquelist;
}
 
开发者ID:lbroudoux,项目名称:es-amazon-s3-river,代码行数:28,代码来源:S3RiverUtil.java

示例2: buildArrayFromSettings

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
/**
 * Extract array from settings (array or ; delimited String)
 * @param settings Settings
 * @param path Path to settings definition
 * @return Array of settings
 */
@SuppressWarnings("unchecked")
public static String[] buildArrayFromSettings(Map<String, Object> settings, String path){
   String[] includes;

   // We manage comma separated format and arrays
   if (XContentMapValues.isArray(XContentMapValues.extractValue(path, settings))) {
      List<String> includesarray = (List<String>) XContentMapValues.extractValue(path, settings);
      int i = 0;
      includes = new String[includesarray.size()];
      for (String include : includesarray) {
         includes[i++] = Strings.trimAllWhitespace(include);
      }
   } else {
      String includedef = (String) XContentMapValues.extractValue(path, settings);
      includes = Strings.commaDelimitedListToStringArray(Strings.trimAllWhitespace(includedef));
   }
   
   String[] uniquelist = Strings.removeDuplicateStrings(includes);
   
   return uniquelist;
}
 
开发者ID:lbroudoux,项目名称:es-google-drive-river,代码行数:28,代码来源:DriveRiverUtil.java

示例3: nodeToAttributeList

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<Attribute> nodeToAttributeList(Object obj, List<Attribute> defaultValue) {
   	if (null != obj && XContentMapValues.isArray(obj)) {
   		List<Attribute> res = new ArrayList<Attribute>();
   		for (Object o : (List<Object>) obj) {
   			if (o instanceof String) {
   				res.add(new Attribute(o.toString()));
   			} else if (o instanceof Map) {
   				Map<String, Object> oMap = (Map<String, Object>) o;
   				if (oMap.containsKey("name")) {
   					if (oMap.containsKey("transform")) {
   						res.add(new Attribute(oMap.get("name").toString(), oMap.get("transform").toString()));
   					} else {
   						res.add(new Attribute(oMap.get("name").toString()));
   					}
   				} 				
   			}
   		}
   		return res;
   	}
	return defaultValue;
   }
 
开发者ID:cwikman,项目名称:elasticsearch-river-jolokia,代码行数:23,代码来源:JolokiaRiver.java

示例4: parse

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked"})
public static List<SQLCommand> parse(Map<String, Object> settings) {
    List<SQLCommand> sql = new LinkedList<SQLCommand>();
    if (!XContentMapValues.isArray(settings.get("sql"))) {
        settings.put("sql", Arrays.asList(settings.get("sql")));
    }
    List<Object> list = (List<Object>) settings.get("sql");
    for (Object entry : list) {
        SQLCommand command = new SQLCommand();
        try {
            if (entry instanceof Map) {
                Map<String, Object> m = (Map<String, Object>) entry;
                if (m.containsKey("statement")) {
                    command.setSQL((String) m.get("statement"));
                }
                if (m.containsKey("parameter")) {
                    command.setParameters(XContentMapValues.extractRawValues("parameter", m));
                }
                if (m.containsKey("callable")) {
                    command.setCallable(XContentMapValues.nodeBooleanValue(m.get("callable")));
                }
                if (m.containsKey("register")) {
                    command.setRegister(XContentMapValues.nodeMapValue(m.get("register"), null));
                }
            } else if (entry instanceof String) {
                command.setSQL((String) entry);
            }
            sql.add(command);
        } catch (IOException e) {
            throw new IllegalArgumentException("SQL command not found", e);
        }
    }
    return sql;
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:35,代码来源:SQLCommand.java

示例5: arrayNodeToList

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<String> arrayNodeToList(Object arrayNode) {
    ArrayList<String> list = new ArrayList<>();
    if(XContentMapValues.isArray(arrayNode)) {
        for(Object node : (List<Object>) arrayNode) {
            String value = XContentMapValues.nodeStringValue(node, null);
            if(value != null) {
                list.add(value);
            }
        }
    }
    return list;
}
 
开发者ID:salyh,项目名称:elasticsearch-imap,代码行数:14,代码来源:IMAPImporter.java

示例6: Neo4jDriver

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@Inject
public Neo4jDriver(RiverName riverName, RiverSettings settings, @RiverIndexName final String riverIndexName, final Client client) {
    super(riverName, settings);
    this.client = client;

    uri = XContentMapValues.nodeStringValue(XContentMapValues.extractValue("neo4j.uri", settings.settings()), DEFAULT_NEO_URI);
    List<Object> neo4jLabels = XContentMapValues.extractRawValues("neo4j.labels", settings.settings());
    String label;
    if(XContentMapValues.isArray(neo4jLabels)) {
        for (Object neo4jLabel : neo4jLabels) {
            label = XContentMapValues.nodeStringValue(neo4jLabel, null);
            labels.add(DynamicLabel.label(label));
        }
    }
    timestampField = XContentMapValues.nodeStringValue(XContentMapValues.extractValue("neo4j.timestampField", settings.settings()), DEFAULT_NEO_TIMESTAMP_FIELD);
    interval = XContentMapValues.nodeIntegerValue(XContentMapValues.extractValue("neo4j.interval", settings.settings()), DEFAULT_NEO_INTERVAL);
    index = XContentMapValues.nodeStringValue(XContentMapValues.extractValue("index.name", settings.settings()), DEFAULT_NEO_INDEX);
    type = XContentMapValues.nodeStringValue(XContentMapValues.extractValue("index.type", settings.settings()), DEFAULT_NEO_TYPE);
    indexFromLabel = XContentMapValues.nodeStringValue(XContentMapValues.extractValue("index.name.label",
        settings.settings()), null);
    typeFromLabel = XContentMapValues.nodeStringValue(XContentMapValues.extractValue("index.type.label",
        settings.settings()), null);

    logger.debug("Neo4j settings [uri={}]", new Object[]{uri});
    logger.debug("River settings [indexName={}, type={}, interval={}, timestampField={}, indexLabel={}, " +
            "typelabel={}]",
        new Object[]{index,
            type,
            interval,
            timestampField,
            indexFromLabel,
            typeFromLabel}
    );

}
 
开发者ID:sksamuel,项目名称:elasticsearch-river-neo4j,代码行数:36,代码来源:Neo4jDriver.java

示例7: nodeToStringList

import org.elasticsearch.common.xcontent.support.XContentMapValues; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<String> nodeToStringList(Object obj, List<String> defaultValue) {
   	if (null != obj && XContentMapValues.isArray(obj)) {
   		List<String> res = new ArrayList<String>();
   		for (Object o : (List<Object>) obj) {
   			res.add(o.toString());
   		}
   		return res;
   	}
	return defaultValue;
   }
 
开发者ID:cwikman,项目名称:elasticsearch-river-jolokia,代码行数:12,代码来源:JolokiaRiver.java


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