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


Java BasicDBList.toArray方法代码示例

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


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

示例1: toAgentCfgDbObject

import com.mongodb.BasicDBList; //导入方法依赖的package包/类
private AgentConfigurationDatabase toAgentCfgDbObject(DBObject dbObject) {
	AgentConfigurationDatabase agentCfgDb = new AgentConfigurationDatabase();
	agentCfgDb.setAgentId((String) dbObject.get("agentId"));
	
	DBObject agentCfgDbObj = (DBObject) dbObject.get("agentConfiguration");
	AgentConfiguration ac = new AgentConfiguration();
	
	ac.setExec((String) agentCfgDbObj.get("exec"));
   	ac.setComponent((String) agentCfgDbObj.get("component"));
   	
   	AgentConfigurationPacketbeat packetbeat = new AgentConfigurationPacketbeat();
   	packetbeat.setStream((String) ((DBObject)agentCfgDbObj.get("packetbeat")).get("stream"));
   	ac.setPacketbeat(packetbeat);
   	
   	AgentConfigurationTopbeat topbeat = new AgentConfigurationTopbeat();
   	topbeat.setStream((String) ((DBObject)agentCfgDbObj.get("topbeat")).get("stream"));
   	ac.setTopbeat(topbeat);
   	
   	AgentConfigurationFilebeat filebeat = new AgentConfigurationFilebeat();
   	filebeat.setStream((String) ((DBObject)agentCfgDbObj.get("filebeat")).get("stream"));
   	BasicDBList paths = (BasicDBList) ((DBObject)agentCfgDbObj.get("filebeat")).get("paths");
   	String[] pathsArr = paths.toArray(new String[0]);
   	List<String> pathsList = new ArrayList<String>();
   	for(String path : pathsArr) {
   		// add to the list
   		pathsList.add(path);
   	}
   	filebeat.setPaths(pathsList);
   	ac.setFilebeat(filebeat);

   	agentCfgDb.setAgentConfiguration(ac);		
	return agentCfgDb;
	
}
 
开发者ID:elastest,项目名称:elastest-instrumentation-manager,代码行数:35,代码来源:AgentConfigurationRepository.java

示例2: convertBasicDBListToObjectArray

import com.mongodb.BasicDBList; //导入方法依赖的package包/类
/**
 * Converts a {@link BasicDBList} into an array of {@link Object}s.
 * @param basicDbList the {@link BasicDBList} to convert.
 * @return the array of {@link Object}s.
 */
public static Object[] convertBasicDBListToObjectArray(final BasicDBList basicDbList) {
    final List<Object> list = new ArrayList<>();
    final Object[] array = basicDbList.toArray();
    for (final Object child : array) {
        if (child instanceof BasicDBList) {
            list.add(convertBasicDBListToObjectArray((BasicDBList)child));
        } else {
            list.add(child);
        }
    }
    return list.toArray(new Object[0]);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:18,代码来源:DocumentVisibilityUtil.java


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