當前位置: 首頁>>代碼示例>>Java>>正文


Java MappingIterator.hasNextValue方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.databind.MappingIterator.hasNextValue方法的典型用法代碼示例。如果您正苦於以下問題:Java MappingIterator.hasNextValue方法的具體用法?Java MappingIterator.hasNextValue怎麽用?Java MappingIterator.hasNextValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.databind.MappingIterator的用法示例。


在下文中一共展示了MappingIterator.hasNextValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deserializeFromIndexFiles

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
protected List<PackageMetadata> deserializeFromIndexFiles(List<File> indexFiles) {
	List<PackageMetadata> packageMetadataList = new ArrayList<>();
	YAMLMapper yamlMapper = new YAMLMapper();
	yamlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	for (File indexFile : indexFiles) {
		try {
			MappingIterator<PackageMetadata> it = yamlMapper.readerFor(PackageMetadata.class).readValues(indexFile);
			while (it.hasNextValue()) {
				PackageMetadata packageMetadata = it.next();
				packageMetadataList.add(packageMetadata);
			}
		}
		catch (IOException e) {
			throw new IllegalArgumentException("Can't parse Release manifest YAML", e);
		}
	}
	return packageMetadataList;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-skipper,代碼行數:19,代碼來源:PackageMetadataService.java

示例2: processForkFile

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void processForkFile(File f, Set<String> users, Set<String> projects) {
	logger.info("Processing "+f);

	try(InputStream in = new FileInputStream(f);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<GitHubForkEvent> it = mapper.readerFor(GitHubForkEvent.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			GitHubForkEvent cde = it.next();
			converterService.mapUserForkEvent(cde,
					users, projects);
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+f, e);
	}    		
	
	
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:19,代碼來源:GithubConverter.java

示例3: processCreateDeleteEntity

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void processCreateDeleteEntity(File f, Set<String> users, Set<String> projects) {
	logger.info("Processing "+f);

	try(InputStream in = new FileInputStream(f);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<GitHubCreateDeleteEvent> it = mapper.readerFor(GitHubCreateDeleteEvent.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			GitHubCreateDeleteEvent cde = it.next();
			converterService.mapUserCreateDeleteEvent(cde,
					users, projects);
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+f, e);
	}    		
	
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:18,代碼來源:GithubConverter.java

示例4: processPushEvents

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void processPushEvents(File f, Set<String> users, Set<String> projects) {
	try(InputStream in = new FileInputStream(f);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		long rows = 0;
		MappingIterator<GitHubPushEvent> it = mapper.readerFor(GitHubPushEvent.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			GitHubPushEvent pe = it.next();
			if (pe.getShas() != null && pe.getShas().length() > 0) {
				String [] shas = pe.getShas().split(";");
				converterService.mapPushEvent(pe, users, projects, commit_shas, shas);
			}
			rows += 1;
			if (rows%10000 == 0) {
				logger.info("....read " + rows + " rows of push_events.csv");
				
			}
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+f, e);
	}    	
			
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:24,代碼來源:GithubConverter.java

示例5: processCommitCommentEvents

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void processCommitCommentEvents(File f, Set<String> users, Set<String> projects, Map<String,Long> commit_shas) {
	logger.info("Processing "+f + ", first for Commit messages... ");

	try(InputStream in = new FileInputStream(f);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<GitHubCommitCommentEvent> it = mapper.readerFor(GitHubCommitCommentEvent.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			GitHubCommitCommentEvent cde = it.next();
			converterService.mapCommitCommentEvent(cde,
					users, projects, commit_shas.get(cde.getProject() + "#" + cde.getSha()));
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+f, e);
	}    		
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:17,代碼來源:GithubConverter.java

示例6: processVersionHistoryFile

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
/**
 * Parses a pypi_versions.csv file and calls converterService to process it.  
 * 
 * Example header plus one row:
 * 
 * project_owner,project_name,pypi_name,pypi_rawname,version,upload_time,python_version,filename
 * skwashd,python-acquia-cloud,acapi,acapi,0.4.1,2015-11-21 09:30:17,source,acapi-0.4.1.tar.gz
 * 
 * @param filename to process
 */
private void processVersionHistoryFile(File file) {
	logger.info("Processing " + file);
	try(InputStream in = new FileInputStream(file);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<RevisionEvent> it = mapper.readerFor(RevisionEvent.class).with(schema).readValues(in);
		boolean first = true;
		while (it.hasNextValue()) {
			RevisionEvent revision = it.next();
			//logger.info("Version: " + revision.getProjectFullName() + ", " + revision.getPypiName() + "/" + revision.getVersion() + " " + revision.getUploadTime());
			converterService.mapVersionInfo(
					revision.getProjectFullName(),
					revision.getPypiName(),
					revision.getVersion(), revision.getFilename() + "?" + revision.getPythonVersion(),
					revision.getUploadTime()
					);
		}
	} catch(Exception e){
		logger.error("Could not parse data file "+file, e);
	}  
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:32,代碼來源:GithubConverter.java

示例7: processWatchEvent

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
/**
 * Parses a CSV file listing who watched what project when, 
 * binds its contents to a GitHubWatcherList object,
 * and passes it on to the DiscourseDB converter
 *
 * File format example:
 * 
 * actor,project,created_at
 * F21,danielstjules/Stringy,2015-01-01T00:01:53Z
    * radlws,tomchristie/django-rest-framework,2015-01-01T00:05:29Z
    * 
 * @param file a dataset file to process
 */
private void processWatchEvent(File file, Set<String> users, Set<String> projects){
	logger.info("Processing "+file);

	try(InputStream in = new FileInputStream(file);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<GitHubWatchEvent> it = mapper.readerFor(GitHubWatchEvent.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			GitHubWatchEvent gwl = it.next();
			converterService.mapUserRepoEvent(
					gwl.getActor(), gwl.getProject(), gwl.getCreatedAt(),
					DiscoursePartInteractionTypes.WATCH,
					users, projects);
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+file, e);
	}    		
	
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:33,代碼來源:GithubConverter.java

示例8: processPullShasFile

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
/**
 * Parses a CSV file listing which pull requests contained which
 * commits (by SHA),
 * and passes it on to the DiscourseDB converter
 *
 * File format example:
 * 
 * (fix me)
    * 
 * @param file a dataset file to process
 */
private void processPullShasFile(File file, Set<String> users, Set<String> projects, Map<String,Long> commit_shas){
	logger.info("Processing "+file);

	try(InputStream in = new FileInputStream(file);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<GitHubPullReqCommits> it = mapper.readerFor(GitHubPullReqCommits.class).with(schema).readValues(in);
		long row=0;
		while (it.hasNextValue()) {
			GitHubPullReqCommits prc = it.next();
			converterService.mapPullRequestCommits(prc, users, projects, commit_shas);
			row += 1;
			if (row%10000 == 0) {
				logger.info("pullShasFile row " + row + " out of about 46,000,000");
			}					
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+file, e);
	}    		
	
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:33,代碼來源:GithubConverter.java

示例9: reprocessForumFileForRelationships

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
/**
 * Parses a dataset file, binds its contents to a POJO and passes it on to the DiscourseDB converter
 * 
 * @param file an dataset file to process
 */
private void reprocessForumFileForRelationships(File file){
	// project_owner,project_name,outside_forum_id,unique_message_id,date,author_email,author_name,
	//    title,body,response_to_message_id,thread_path,message_path

	logger.info("Processing "+file);

	CsvMapper mapper = new CsvMapper();
	CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
	try(InputStream in = new FileInputStream(file);) {

		MappingIterator<MailingListComment> it = mapper.readerFor(MailingListComment.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			MailingListComment currentPost = it.next();	
			converterService.mapForumPostRelation(currentPost, "GOOGLE_GROUPS");        			
		}

	}catch(Exception e){
		logger.error("Could not parse data file "+file, e);
	}    		
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:26,代碼來源:GithubConverter.java

示例10: doProcess

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
@Override
protected boolean doProcess(Record inputRecord, InputStream in) throws IOException {
  MappingIterator iter = reader.readValues(in);
  try {
    while (iter.hasNextValue()) {
      Object rootNode = iter.nextValue();
      incrementNumRecords();
      LOG.debug("jsonObject: {}", rootNode);
      
      Record outputRecord = inputRecord.copy();
      removeAttachments(outputRecord);
      outputRecord.put(Fields.ATTACHMENT_BODY, rootNode);
      outputRecord.put(Fields.ATTACHMENT_MIME_TYPE, MIME_TYPE);
  
      // pass record to next command in chain:
      if (!getChild().process(outputRecord)) {
        return false;
      }
    }
    return true;
  } finally {
    iter.close();
  }
}
 
開發者ID:cloudera,項目名稱:cdk,代碼行數:25,代碼來源:ReadJsonBuilder.java

示例11: run

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
@Override
public void run() {
    try {
        try (final Socket socket = serverSocket.accept()) {
            if (socket != null) {
                final InputStream is = socket.getInputStream();
                while (!shutdown) {
                    final MappingIterator<LogEvent> mappingIterator = objectMapper.readerFor(Log4jLogEvent.class).readValues(is);
                    while (mappingIterator.hasNextValue()) {
                        queue.add(mappingIterator.nextValue());
                        ++count;
                    }
                }
            }
        }
    } catch (final EOFException eof) {
        // Socket is closed.
    } catch (final Exception e) {
        if (!shutdown) {
            Throwables.rethrow(e);
        }
    }
}
 
開發者ID:apache,項目名稱:logging-log4j2,代碼行數:24,代碼來源:SocketAppenderTest.java

示例12: toList

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
protected static <T> List<T> toList(MappingIterator<T> iter) throws java.io.IOException {
    List<T> answer = new ArrayList<>();
    while (iter != null && iter.hasNextValue()) {
        T value = iter.nextValue();
        answer.add(value);
    }
    return answer;
}
 
開發者ID:fabric8io,項目名稱:fabric8-forge,代碼行數:9,代碼來源:NodeDtos.java

示例13: fromCsv

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private List<BinaryLabeledContributionInterchange> fromCsv(String inputFileName) throws IOException{
	List<BinaryLabeledContributionInterchange> itemList = new ArrayList<>();
	try(InputStream in = new FileInputStream(inputFileName);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaFor(BinaryLabeledContributionInterchange.class);
		MappingIterator<BinaryLabeledContributionInterchange> it = mapper.readerFor(BinaryLabeledContributionInterchange.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			itemList.add(it.next());
		}
	}			
	return itemList;
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:13,代碼來源:ContributionBinaryLabelImporter.java

示例14: convert

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
/**
 * Stream-reads the json input and binds each post in the dataset to an
 * object that is passed on to the mapper.
 * 
 * @param inFile
 *            of json file that contains forum data
 * @throws IOException
 *             in case the inFile could not be read
 * @throws JsonParseException
 *             in case the json was malformed and couln't be parsed
 */
public void convert(String inFile) throws JsonParseException, JsonProcessingException, IOException {
	final InputStream in = new FileInputStream(inFile);
	try {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaFor(UserInfo.class).withColumnSeparator('\t').withHeader();
		MappingIterator<UserInfo> it = mapper.readerFor(UserInfo.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			UserInfo curPost = it.next();
			map(curPost);
		}
	} finally {
		in.close();
	}
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:26,代碼來源:UserInfoParserTest.java

示例15: processGollumFile

import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void processGollumFile(File f, Set<String> users, Set<String> projects) {
	logger.info("Processing "+f);

	try(InputStream in = new FileInputStream(f);) {
		CsvMapper mapper = new CsvMapper();
		CsvSchema schema = mapper.schemaWithHeader().withNullValue("None");
		MappingIterator<GitHubGollumEvent> it = mapper.readerFor(GitHubGollumEvent.class).with(schema).readValues(in);
		while (it.hasNextValue()) {
			GitHubGollumEvent ge = it.next();
			converterService.mapGollumEvent(ge,users, projects);
		}
	}catch(Exception e){
		logger.error("Could not parse data file "+f, e);
	}    			
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:16,代碼來源:GithubConverter.java


注:本文中的com.fasterxml.jackson.databind.MappingIterator.hasNextValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。