branch develop updated (476e230 -> 28f58c1)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git from 476e230 Fix build new 2d79afb While using Import2, add a new configuration property to clone ImportRow to be able to copy rows for later treatments (See #4044) new 28f58c1 While using Import2, add a new configuration property to clone ImportRow to be able to copy rows for later treatments (Fixes #4044) Merge branch 'feature/4044' into develop The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 28f58c15e3966c89562875f7afbeb7044332981d Merge: 476e230 2d79afb Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Sep 28 18:08:46 2016 +0200 While using Import2, add a new configuration property to clone ImportRow to be able to copy rows for later treatments (Fixes #4044) Merge branch 'feature/4044' into develop commit 2d79afb95ebe645824da5f64391005be17504ee7 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Sep 28 18:08:33 2016 +0200 While using Import2, add a new configuration property to clone ImportRow to be able to copy rows for later treatments (See #4044) Summary of changes: src/main/java/org/nuiton/csv/Import2.java | 6 +++++- src/main/java/org/nuiton/csv/ImportConf.java | 16 ++++++++++++++++ src/main/java/org/nuiton/csv/ImportRow.java | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git commit 2d79afb95ebe645824da5f64391005be17504ee7 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Sep 28 18:08:33 2016 +0200 While using Import2, add a new configuration property to clone ImportRow to be able to copy rows for later treatments (See #4044) --- src/main/java/org/nuiton/csv/Import2.java | 6 +++++- src/main/java/org/nuiton/csv/ImportConf.java | 16 ++++++++++++++++ src/main/java/org/nuiton/csv/ImportRow.java | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/nuiton/csv/Import2.java b/src/main/java/org/nuiton/csv/Import2.java index cd60321..9e90202 100644 --- a/src/main/java/org/nuiton/csv/Import2.java +++ b/src/main/java/org/nuiton/csv/Import2.java @@ -346,7 +346,7 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { private class ImportRowIterator implements Iterator<ImportRow<E>> { - protected final ImportRow<E> row; + protected ImportRow<E> row; protected final List<ImportableColumn<E, Object>> columns; @@ -374,6 +374,10 @@ public class Import2<E> implements Iterable<ImportRow<E>>, Closeable { throw new NoSuchElementException(); } + if (conf.isCloneImportRow()) { + row = new ImportRow<>(row); + } + E element = model.newEmptyInstance(); row.prepareNextRow(element); diff --git a/src/main/java/org/nuiton/csv/ImportConf.java b/src/main/java/org/nuiton/csv/ImportConf.java index 8887cbe..f321c28 100644 --- a/src/main/java/org/nuiton/csv/ImportConf.java +++ b/src/main/java/org/nuiton/csv/ImportConf.java @@ -59,6 +59,14 @@ public class ImportConf { */ protected boolean ignoreUnknownHeader = false; + /** + * Flag to clone the import row while iterating on it. + * + * If not set then a shared instance of ImportRow is used, this means that you can't copy the iterable into a another one. + * @since 3.0 + */ + protected boolean cloneImportRow = false; + public boolean isSafetySwitch() { return safetySwitch; } @@ -82,4 +90,12 @@ public class ImportConf { public void setIgnoreUnknownHeader(boolean ignoreUnknownHeader) { this.ignoreUnknownHeader = ignoreUnknownHeader; } + + public boolean isCloneImportRow() { + return cloneImportRow; + } + + public void setCloneImportRow(boolean cloneImportRow) { + this.cloneImportRow = cloneImportRow; + } } diff --git a/src/main/java/org/nuiton/csv/ImportRow.java b/src/main/java/org/nuiton/csv/ImportRow.java index 42282c4..07db7f8 100644 --- a/src/main/java/org/nuiton/csv/ImportRow.java +++ b/src/main/java/org/nuiton/csv/ImportRow.java @@ -25,6 +25,7 @@ package org.nuiton.csv; import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; +import java.util.Collections; import java.util.Set; /** @@ -67,7 +68,7 @@ public class ImportRow<E> { } public Set<AbstractImportErrorInfo<E>> getErrors() { - return errors; + return errors == null ? Collections.<AbstractImportErrorInfo<E>>emptySet() : errors; } public boolean isValid() { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-csv. See https://gitlab.nuiton.org/nuiton/nuiton-csv.git commit 28f58c15e3966c89562875f7afbeb7044332981d Merge: 476e230 2d79afb Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Sep 28 18:08:46 2016 +0200 While using Import2, add a new configuration property to clone ImportRow to be able to copy rows for later treatments (Fixes #4044) Merge branch 'feature/4044' into develop src/main/java/org/nuiton/csv/Import2.java | 6 +++++- src/main/java/org/nuiton/csv/ImportConf.java | 16 ++++++++++++++++ src/main/java/org/nuiton/csv/ImportRow.java | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm