Repository: camel Updated Branches: refs/heads/master 94f621d15 -> 0b243a48a
Fixed CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0b243a48 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0b243a48 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0b243a48 Branch: refs/heads/master Commit: 0b243a48aea3f30fba8460c7b26f7b184b3c6456 Parents: 94f621d Author: Andrea Cosentino <[email protected]> Authored: Tue Aug 1 15:09:21 2017 +0200 Committer: Andrea Cosentino <[email protected]> Committed: Tue Aug 1 15:09:21 2017 +0200 ---------------------------------------------------------------------- .../camel/dataformat/univocity/Marshaller.java | 43 +++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0b243a48/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java ---------------------------------------------------------------------- diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java index 1161559..1e5d1c1 100644 --- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java +++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java @@ -16,22 +16,22 @@ */ package org.apache.camel.dataformat.univocity; -import static org.apache.camel.util.ExchangeHelper.convertToMandatoryType; -import static org.apache.camel.util.ExchangeHelper.convertToType; - import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import com.univocity.parsers.common.AbstractWriter; + import org.apache.camel.Exchange; import org.apache.camel.NoTypeConversionAvailableException; -import com.univocity.parsers.common.AbstractWriter; +import static org.apache.camel.util.ExchangeHelper.convertToMandatoryType; +import static org.apache.camel.util.ExchangeHelper.convertToType; /** - * This class marshalls the exchange body using an uniVocity writer. It can automatically generates headers and keep - * their order in memory. + * This class marshalls the exchange body using an uniVocity writer. It can + * automatically generates headers and keep their order in memory. * * @param <W> Writer class */ @@ -42,8 +42,9 @@ final class Marshaller<W extends AbstractWriter<?>> { /** * Creates a new instance. * - * @param headers the base headers to use - * @param adaptHeaders whether or not we can add headers on the fly depending on the data + * @param headers the base headers to use + * @param adaptHeaders whether or not we can add headers on the fly + * depending on the data */ Marshaller(String[] headers, boolean adaptHeaders) { if (headers != null) { @@ -56,9 +57,10 @@ final class Marshaller<W extends AbstractWriter<?>> { * Marshals the given body. * * @param exchange exchange to use (for type conversion) - * @param body body to marshal - * @param writer uniVocity writer to use - * @throws NoTypeConversionAvailableException when it's not possible to convert the body as list and maps. + * @param body body to marshal + * @param writer uniVocity writer to use + * @throws NoTypeConversionAvailableException when it's not possible to + * convert the body as list and maps. */ public void marshal(Exchange exchange, Object body, W writer) throws NoTypeConversionAvailableException { try { @@ -79,9 +81,10 @@ final class Marshaller<W extends AbstractWriter<?>> { * Writes the given row. * * @param exchange exchange to use (for type conversion) - * @param row row to write - * @param writer uniVocity writer to use - * @throws NoTypeConversionAvailableException when it's not possible to convert the row as map. + * @param row row to write + * @param writer uniVocity writer to use + * @throws NoTypeConversionAvailableException when it's not possible to + * convert the row as map. */ private void writeRow(Exchange exchange, Object row, W writer) throws NoTypeConversionAvailableException { Map<?, ?> map = convertToMandatoryType(exchange, Map.class, row); @@ -104,11 +107,11 @@ final class Marshaller<W extends AbstractWriter<?>> { * @param writer uniVocity writer to use */ private void writeRow(Map<?, ?> map, W writer) { - Object[] values = new Object[headers.size()]; - int index = 0; - for (String header : headers) { - values[index++] = map.get(header); - } - writer.writeRow(values); + Object[] values = new Object[headers.size()]; + int index = 0; + for (String header : headers) { + values[index++] = map.get(header); + } + writer.writeRow(values); } }
