本文整理匯總了Java中com.fasterxml.jackson.databind.MappingIterator.next方法的典型用法代碼示例。如果您正苦於以下問題:Java MappingIterator.next方法的具體用法?Java MappingIterator.next怎麽用?Java MappingIterator.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.fasterxml.jackson.databind.MappingIterator
的用法示例。
在下文中一共展示了MappingIterator.next方法的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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例10: getMessages
import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
public Messages getMessages() {
Messages messages = null;
InputStream is = res.getResourceAsStream("json/messages.json");
try {
JsonFactory jsonFactory = new JsonFactory();
JsonParser jsonParser = jsonFactory.createParser(is);
ObjectMapper mapper = new ObjectMapper();
MappingIterator<Messages> messagesMappingIterator = mapper.readValues(jsonParser, Messages.class);
messages = messagesMappingIterator.next();
} catch (IOException e) {
e.printStackTrace();
}
return messages;
}
示例11: linkPresentations
import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void linkPresentations(File dir, List<Medicament> medicaments) throws IOException {
LOG.info("liste présentations");
CsvMapper csvMapper = new CsvMapper();
CsvSchema schema = csvMapper.schemaFor(PresentationCSV.class).withArrayElementSeparator(';').withColumnSeparator('\t');
MappingIterator<PresentationCSV> it = csvMapper.readerFor(PresentationCSV.class).with(schema).readValues(new File(dir, Constants.CIS_CIP_BDPM_FILE));
Medicament medicament;
while (it.hasNext()) {
PresentationCSV presentation = it.next();
LOG.debug("référencement presentation médicament - CodeCIS : " + presentation.getCodeCIS());
medicament = medicaments.stream()
.filter(x -> x.getCodeCIS().equals(presentation.getCodeCIS()))
.findFirst().orElse(null);
if (medicament != null) {
medicament.getPresentations().add(mapper.toPresentationES(presentation));
}
}
}
示例12: linkAvisSMR
import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void linkAvisSMR(File dir, List<Medicament> medicaments, Map<String, String> urlsHAS) throws IOException {
LOG.info("liste avis SMR");
CsvMapper csvMapper = new CsvMapper();
CsvSchema schema = csvMapper.schemaFor(AvisSMRCSV.class).withArrayElementSeparator(';').withColumnSeparator('\t');
MappingIterator<AvisSMRCSV> it = csvMapper.readerFor(AvisSMRCSV.class).with(schema).readValues(new File(dir, Constants.CIS_HAS_SMR_BDPM_FILE));
Medicament medicament;
AvisSMR avisSMR;
while (it.hasNext()) {
AvisSMRCSV csv = it.next();
LOG.debug("référencement SMR médicament - CodeCIS : " + csv.getCodeCIS());
medicament = medicaments.stream()
.filter(x -> x.getCodeCIS().equals(csv.getCodeCIS()))
.findFirst().orElse(null);
if (medicament != null) {
avisSMR = mapper.toAvisSMRES(csv);
avisSMR.setUrlHAS(urlsHAS.get(avisSMR.getCodeDossierHAS()));
medicament.getAvisSMR().add(avisSMR);
}
}
}
示例13: linkAvisASMR
import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private void linkAvisASMR(File dir, List<Medicament> medicaments, Map<String, String> urlsHAS) throws IOException {
LOG.info("liste avis ASMR");
CsvMapper csvMapper = new CsvMapper();
CsvSchema schema = csvMapper.schemaFor(AvisASMRCSV.class).withArrayElementSeparator(';').withColumnSeparator('\t');
MappingIterator<AvisASMRCSV> it = csvMapper.readerFor(AvisASMRCSV.class).with(schema).readValues(new File(dir, Constants.CIS_HAS_ASMR_BDPM_FILE));
Medicament medicament;
AvisASMR avisASMR;
while (it.hasNext()) {
AvisASMRCSV csv = it.next();
LOG.debug("référencement ASMR médicament - CodeCIS : " + csv.getCodeCIS());
medicament = medicaments.stream()
.filter(x -> x.getCodeCIS().equals(csv.getCodeCIS()))
.findFirst().orElse(null);
if (medicament != null) {
avisASMR = mapper.toAvisASMRES(csv);
avisASMR.setUrlHAS(urlsHAS.get(avisASMR.getCodeDossierHAS()));
medicament.getAvisASMR().add(avisASMR);
}
}
}
示例14: loadPublisherMap
import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
private ImmutableMultimap<String, String> loadPublisherMap(String file) {
// todo make sortedsetmultimap
Multimap<String, String> temp = LinkedHashMultimap.create();
CsvMapper mapper = new CsvMapper();
mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
try {
MappingIterator<Object[]> it = mapper.reader(Object[].class).readValues(
getClass().getResourceAsStream(file));
while (it.hasNext()) {
Object[] row = it.next();
if (row.length > 1 && (row[0] != null && row[1] != null)
&& (!row[0].toString().isEmpty() && !row[1].toString().isEmpty())) {
temp.put(row[1].toString().trim(), row[0].toString().trim());
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return ImmutableMultimap.copyOf(temp);
}
示例15: test
import com.fasterxml.jackson.databind.MappingIterator; //導入方法依賴的package包/類
public void test() throws IOException {
CsvMapper mapper = new CsvMapper();
mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
CsvSchema schema = CsvSchema.emptySchema();
// schema = schema.withHeader();
// schema = schema.withQuoteChar('\'');
// File csvFile = new File("/Temp/llunatic/doctors/10k/doctor.csv");
File csvFile = new File("/Users/donatello/Temp/chaseBench-workspace/LUBM/data/01k/src-emailAddress.csv");
long start = new Date().getTime();
MappingIterator<String[]> it = mapper.readerFor(String[].class).with(schema).readValues(csvFile);
String[] row = it.next();
System.out.println(Arrays.asList(row));
long end = new Date().getTime();
System.out.println("**** " + (end - start) + " ms");
// while (it.hasNext()) {
// String[] row = it.next();
// System.out.println(Arrays.asList(row));
// }
}