當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。