Repository: camel Updated Branches: refs/heads/master 39d286b80 -> 45f0752c7
Fix all the checkstyle issues in camel-bindy Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d64d5548 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d64d5548 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d64d5548 Branch: refs/heads/master Commit: d64d5548c92d6ab310455f7349fb207787b1afe3 Parents: 39d286b Author: Daniel Kulp <dk...@apache.org> Authored: Wed Aug 27 10:14:47 2014 -0400 Committer: Daniel Kulp <dk...@apache.org> Committed: Wed Aug 27 10:14:47 2014 -0400 ---------------------------------------------------------------------- .../camel/dataformat/bindy/FormatFactory.java | 26 ++++++++++++++++-- .../bindy/format/BigDecimalPatternFormat.java | 21 ++++++++++++-- .../BindySimpleCsvBooleanFalseMarshallTest.java | 2 -- .../BindySimpleCsvBooleanTrueMarshallTest.java | 2 -- .../BindyBigDecimalGroupingUnmarshallTest.java | 28 +++++++++++++------ .../BindyBigDecimalRoundingUnmarshallTest.java | 29 ++++++++++++++------ 6 files changed, 82 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d64d5548/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java index 794aace..48230a1 100755 --- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java +++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java @@ -24,7 +24,26 @@ import java.util.Locale; import org.apache.camel.dataformat.bindy.annotation.DataField; import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField; -import org.apache.camel.dataformat.bindy.format.*; +import org.apache.camel.dataformat.bindy.format.BigDecimalFormat; +import org.apache.camel.dataformat.bindy.format.BigDecimalPatternFormat; +import org.apache.camel.dataformat.bindy.format.BigIntegerFormat; +import org.apache.camel.dataformat.bindy.format.BooleanFormat; +import org.apache.camel.dataformat.bindy.format.ByteFormat; +import org.apache.camel.dataformat.bindy.format.BytePatternFormat; +import org.apache.camel.dataformat.bindy.format.CharacterFormat; +import org.apache.camel.dataformat.bindy.format.DatePatternFormat; +import org.apache.camel.dataformat.bindy.format.DoubleFormat; +import org.apache.camel.dataformat.bindy.format.DoublePatternFormat; +import org.apache.camel.dataformat.bindy.format.EnumFormat; +import org.apache.camel.dataformat.bindy.format.FloatFormat; +import org.apache.camel.dataformat.bindy.format.FloatPatternFormat; +import org.apache.camel.dataformat.bindy.format.IntegerFormat; +import org.apache.camel.dataformat.bindy.format.IntegerPatternFormat; +import org.apache.camel.dataformat.bindy.format.LongFormat; +import org.apache.camel.dataformat.bindy.format.LongPatternFormat; +import org.apache.camel.dataformat.bindy.format.ShortFormat; +import org.apache.camel.dataformat.bindy.format.ShortPatternFormat; +import org.apache.camel.dataformat.bindy.format.StringFormat; import org.apache.camel.util.ObjectHelper; @@ -50,7 +69,6 @@ public final class FormatFactory { * @return Format the formatter * @throws IllegalArgumentException if not suitable formatter is found */ - @SuppressWarnings("unchecked") private static Format<?> doGetFormat(Class<?> clazz, String pattern, String locale, String timezone, int precision, String rounding, boolean impliedDecimalSeparator, String decimalSeparator, String groupingSeparator) @@ -94,7 +112,9 @@ public final class FormatFactory { } else if (clazz == boolean.class || clazz == Boolean.class) { return new BooleanFormat(); } else if (clazz.isEnum()) { - return new EnumFormat(clazz); + @SuppressWarnings({"rawtypes", "unchecked"}) + Format<?> fmt = new EnumFormat(clazz); + return fmt; } else { throw new IllegalArgumentException("Can not find a suitable formatter for the type: " + clazz.getCanonicalName()); } http://git-wip-us.apache.org/repos/asf/camel/blob/d64d5548/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalPatternFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalPatternFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalPatternFormat.java index ae1200d..78e4378 100644 --- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalPatternFormat.java +++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalPatternFormat.java @@ -1,14 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.camel.dataformat.bindy.format; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; -import java.text.NumberFormat; import java.util.Locale; public class BigDecimalPatternFormat extends NumberPatternFormat<BigDecimal> { - public void BigDecimalPatternFormat() { + public BigDecimalPatternFormat() { } public BigDecimalPatternFormat(String pattern, Locale locale, int precision, String rounding, String decimalSeparator, String groupingSeparator) { @@ -22,7 +37,7 @@ public class BigDecimalPatternFormat extends NumberPatternFormat<BigDecimal> { DecimalFormat df = (DecimalFormat)getNumberFormat(); df.setParseBigDecimal(true); BigDecimal bd = (BigDecimal)df.parse(string.trim()); - if(super.getPrecision() != -1) { + if (super.getPrecision() != -1) { bd = bd.setScale(super.getPrecision(), RoundingMode.valueOf(super.getRounding())); } Locale.getDefault(); http://git-wip-us.apache.org/repos/asf/camel/blob/d64d5548/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java index 18d649c..11121a5 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanFalseMarshallTest.java @@ -55,8 +55,6 @@ public class BindySimpleCsvBooleanFalseMarshallTest extends AbstractJUnit4Spring public List<Map<String, Object>> generateModel() { Map<String, Object> modelObjects = new HashMap<String, Object>(); - - List<BooleanExample> list = new ArrayList<BooleanExample>(); BooleanExample example = new BooleanExample(); http://git-wip-us.apache.org/repos/asf/camel/blob/d64d5548/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java index a707253..8b0fd9e 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvBooleanTrueMarshallTest.java @@ -56,8 +56,6 @@ public class BindySimpleCsvBooleanTrueMarshallTest extends AbstractJUnit4SpringC public List<Map<String, Object>> generateModel() { Map<String, Object> modelObjects = new HashMap<String, Object>(); - List<BooleanExample> list = new ArrayList<BooleanExample>(); - BooleanExample example = new BooleanExample(); example.setName("andrew"); http://git-wip-us.apache.org/repos/asf/camel/blob/d64d5548/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/grouping/BindyBigDecimalGroupingUnmarshallTest.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/grouping/BindyBigDecimalGroupingUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/grouping/BindyBigDecimalGroupingUnmarshallTest.java index 714c678..7c0c9de 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/grouping/BindyBigDecimalGroupingUnmarshallTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/grouping/BindyBigDecimalGroupingUnmarshallTest.java @@ -1,5 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.camel.dataformat.bindy.number.grouping; +import java.math.BigDecimal; + import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -12,15 +30,9 @@ import org.apache.camel.model.dataformat.BindyType; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Assert; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.math.BigDecimal; public class BindyBigDecimalGroupingUnmarshallTest extends CamelTestSupport { - private static final Logger LOG = LoggerFactory.getLogger(BindyBigDecimalGroupingUnmarshallTest.class); - private static final String URI_MOCK_RESULT = "mock:result"; private static final String URI_DIRECT_START = "direct:start"; @@ -59,8 +71,8 @@ public class BindyBigDecimalGroupingUnmarshallTest extends CamelTestSupport { bindy.setLocale("en"); from(URI_DIRECT_START) - .unmarshal(bindy) - .to(URI_MOCK_RESULT); + .unmarshal(bindy) + .to(URI_MOCK_RESULT); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/d64d5548/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/rounding/BindyBigDecimalRoundingUnmarshallTest.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/rounding/BindyBigDecimalRoundingUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/rounding/BindyBigDecimalRoundingUnmarshallTest.java index ba7262b..694463a 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/rounding/BindyBigDecimalRoundingUnmarshallTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/number/rounding/BindyBigDecimalRoundingUnmarshallTest.java @@ -1,5 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.camel.dataformat.bindy.number.rounding; +import java.math.BigDecimal; + import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -12,15 +30,10 @@ import org.apache.camel.model.dataformat.BindyType; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Assert; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.math.BigDecimal; public class BindyBigDecimalRoundingUnmarshallTest extends CamelTestSupport { - private static final Logger LOG = LoggerFactory.getLogger(BindyBigDecimalRoundingUnmarshallTest.class); - private static final String URI_MOCK_RESULT = "mock:result"; private static final String URI_DIRECT_START = "direct:start"; @@ -45,7 +58,7 @@ public class BindyBigDecimalRoundingUnmarshallTest extends CamelTestSupport { result.assertIsSatisfied(); NumberModel bd = (NumberModel)result.getExchanges().get(0).getIn().getBody(); - Assert.assertEquals(bigDecimal,bd.getRoundingUp().toString()); + Assert.assertEquals(bigDecimal, bd.getRoundingUp().toString()); } @Override @@ -60,8 +73,8 @@ public class BindyBigDecimalRoundingUnmarshallTest extends CamelTestSupport { bindy.setLocale("en"); from(URI_DIRECT_START) - .unmarshal(bindy) - .to(URI_MOCK_RESULT); + .unmarshal(bindy) + .to(URI_MOCK_RESULT); } };