CAMEL-9954: FormatFactory should be real Factory-pattern

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/311d429c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/311d429c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/311d429c

Branch: refs/heads/master
Commit: 311d429c0dc8a10424858a68505ce4105a22afdf
Parents: b8a9afc
Author: Arno Noordover <[email protected]>
Authored: Sun May 8 11:46:17 2016 +0200
Committer: Claus Ibsen <[email protected]>
Committed: Sat May 21 12:37:16 2016 +0200

----------------------------------------------------------------------
 .../dataformat/bindy/BindyAbstractFactory.java  |   3 +-
 .../camel/dataformat/bindy/BindyCsvFactory.java |  20 +-
 .../bindy/BindyFixedLengthFactory.java          |  15 +-
 .../bindy/BindyKeyValuePairFactory.java         |  25 ++-
 .../camel/dataformat/bindy/FormatFactory.java   | 217 ++++++-------------
 .../dataformat/bindy/FormattingOptions.java     | 139 ++++++++++++
 .../bindy/csv/BindyCsvDataFormat.java           |   2 +-
 .../bindy/fixed/BindyFixedLengthDataFormat.java |   2 +-
 .../bindy/format/BigDecimalFormat.java          |  47 ----
 .../bindy/format/BigDecimalPatternFormat.java   |  47 ----
 .../bindy/format/BigIntegerFormat.java          |  31 ---
 .../dataformat/bindy/format/BooleanFormat.java  |  31 ---
 .../dataformat/bindy/format/ByteFormat.java     |  31 ---
 .../bindy/format/BytePatternFormat.java         |  39 ----
 .../bindy/format/CharacterFormat.java           |  36 ---
 .../bindy/format/DatePatternFormat.java         | 106 ---------
 .../dataformat/bindy/format/DoubleFormat.java   |  46 ----
 .../bindy/format/DoublePatternFormat.java       |  39 ----
 .../dataformat/bindy/format/EnumFormat.java     |  36 ---
 .../dataformat/bindy/format/FloatFormat.java    |  46 ----
 .../bindy/format/FloatPatternFormat.java        |  39 ----
 .../dataformat/bindy/format/IntegerFormat.java  |  30 ---
 .../bindy/format/IntegerPatternFormat.java      |  39 ----
 .../bindy/format/LocalDatePatternFormat.java    |  85 --------
 .../format/LocalDateTimePatternFormat.java      |  94 --------
 .../bindy/format/LocalTimePatternFormat.java    |  95 --------
 .../dataformat/bindy/format/LongFormat.java     |  30 ---
 .../bindy/format/LongPatternFormat.java         |  39 ----
 .../dataformat/bindy/format/ShortFormat.java    |  30 ---
 .../bindy/format/ShortPatternFormat.java        |  38 ----
 .../dataformat/bindy/format/StringFormat.java   |  31 ---
 .../format/factories/AbstractFormatFactory.java |  37 ++++
 .../factories/BigDecimalFormatFactory.java      |  70 ++++++
 .../BigDecimalPatternFormatFactory.java         |  71 ++++++
 .../factories/BigIntegerFormatFactory.java      |  53 +++++
 .../format/factories/BooleanFormatFactory.java  |  47 ++++
 .../format/factories/ByteFormatFactory.java     |  54 +++++
 .../factories/BytePatternFormatFactory.java     |  60 +++++
 .../factories/CharacterFormatFactory.java       |  51 +++++
 .../format/factories/DateFormatFactory.java     | 114 ++++++++++
 .../format/factories/DoubleFormatFactory.java   |  71 ++++++
 .../factories/DoublePatternFormatFactory.java   |  61 ++++++
 .../format/factories/EnumFormatFactory.java     |  53 +++++
 .../format/factories/FloatFormatFactory.java    |  72 ++++++
 .../factories/FloatPatternFormatFactory.java    |  61 ++++++
 .../bindy/format/factories/FormatFactories.java |  99 +++++++++
 .../factories/FormatFactoryInterface.java       |  48 ++++
 .../format/factories/IntegerFormatFactory.java  |  56 +++++
 .../factories/IntegerPatternFormatFactory.java  |  61 ++++++
 .../factories/LocalDateFormatFactory.java       |  98 +++++++++
 .../factories/LocalDateTimeFormatFactory.java   | 109 ++++++++++
 .../factories/LocalTimeFormatFactory.java       | 109 ++++++++++
 .../format/factories/LongFormatFactory.java     |  55 +++++
 .../factories/LongPatternFormatFactory.java     |  61 ++++++
 .../format/factories/ShortFormatFactory.java    |  56 +++++
 .../factories/ShortPatternFormatFactory.java    |  60 +++++
 .../format/factories/StringFormatFactory.java   |  47 ++++
 .../bindy/kvp/BindyKeyValuePairDataFormat.java  |   2 +-
 .../dataformat/bindy/util/ConverterUtils.java   |  30 +++
 .../factories/BigDecimalFormatFactoryTest.java  |  48 ++++
 .../date/BindyDatePatternCsvUnmarshallTest.java |  18 +-
 61 files changed, 2083 insertions(+), 1257 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index 959e40c..d3e96b9 100644
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
 public abstract class BindyAbstractFactory implements BindyFactory {
     private static final Logger LOG = 
LoggerFactory.getLogger(BindyAbstractFactory.class);
     protected final Map<String, List<Field>> annotatedLinkFields = new 
LinkedHashMap<String, List<Field>>();
+    protected final FormatFactory formatFactory = FormatFactory.getInstance();
     protected Set<Class<?>> models;
     protected Set<String> modelClassNames;
     protected String crlf;
@@ -168,7 +169,7 @@ public abstract class BindyAbstractFactory implements 
BindyFactory {
         String key2Formatted;
         String keyGenerated;
 
-        // Test added for ticket - camel-2773
+        // BigIntegerFormatFactory added for ticket - camel-2773
         if ((key1 != null) && (key2 != null)) {
             key2Formatted = getNumberFormat().format((long) key2);
             keyGenerated = String.valueOf(key1) + key2Formatted;

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 045970d..e92bdc5 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -192,7 +192,11 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
             }
 
             // Create format object to format the field
-            Format<?> format = FormatFactory.getFormat(field.getType(), 
getLocale(), dataField, field.getAnnotation(BindyConverter.class));
+            FormattingOptions formattingOptions = 
ConverterUtils.convert(dataField,
+                    field.getType(),
+                    field.getAnnotation(BindyConverter.class),
+                    getLocale());
+            Format<?> format = formatFactory.getFormat(formattingOptions);
 
             // field object to be set
             Object modelField = model.get(field.getDeclaringClass().getName());
@@ -396,7 +400,11 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
                     Class<?> type = field.getType();
 
                     // Create format
-                    Format<?> format = FormatFactory.getFormat(type, 
getLocale(), datafield, field.getAnnotation(BindyConverter.class));
+                    FormattingOptions formattingOptions = 
ConverterUtils.convert(datafield,
+                            field.getType(),
+                            field.getAnnotation(BindyConverter.class),
+                            getLocale());
+                    Format<?> format = 
formatFactory.getFormat(formattingOptions);
 
                     // Get field value
                     Object value = field.get(obj);
@@ -565,7 +573,7 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
                 }
 
                 if (section != null) {
-                    // Test if section number is not null
+                    // BigIntegerFormatFactory if section number is not null
                     ObjectHelper.notNull(section.number(), "No number has been 
defined for the section");
 
                     // Get section number and add it to the sections
@@ -589,7 +597,11 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
             DataField dataField = dataFields.get(i);
             Object modelField = model.get(field.getDeclaringClass().getName());
             if (field.get(modelField) == null && 
!dataField.defaultValue().isEmpty()) {
-                Format<?> format = FormatFactory.getFormat(field.getType(), 
getLocale(), dataField, field.getAnnotation(BindyConverter.class));
+                FormattingOptions formattingOptions = 
ConverterUtils.convert(dataField,
+                        field.getType(),
+                        field.getAnnotation(BindyConverter.class),
+                        getLocale());
+                Format<?> format = formatFactory.getFormat(formattingOptions);
                 Object value = format.parse(dataField.defaultValue());
                 field.set(modelField, value);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
index d6b8aed..4efddf4 100644
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
@@ -32,6 +32,7 @@ import org.apache.camel.dataformat.bindy.annotation.DataField;
 import org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord;
 import org.apache.camel.dataformat.bindy.annotation.Link;
 import org.apache.camel.dataformat.bindy.format.FormatException;
+import org.apache.camel.dataformat.bindy.util.ConverterUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -47,6 +48,8 @@ public class BindyFixedLengthFactory extends 
BindyAbstractFactory implements Bin
 
     boolean isOneToMany;
 
+    private final FormatFactory formatFactory = FormatFactory.getInstance();
+
     private Map<Integer, DataField> dataFields = new TreeMap<Integer, 
DataField>();
     private Map<Integer, Field> annotatedFields = new TreeMap<Integer, 
Field>();
 
@@ -239,7 +242,11 @@ public class BindyFixedLengthFactory extends 
BindyAbstractFactory implements Bin
             }
 
             // Create format object to format the field
-            Format<?> format = FormatFactory.getFormat(field.getType(), 
getLocale(), dataField, field.getAnnotation(BindyConverter.class));
+            FormattingOptions formattingOptions = 
ConverterUtils.convert(dataField,
+                    field.getType(),
+                    field.getAnnotation(BindyConverter.class),
+                    getLocale());
+            Format<?> format = formatFactory.getFormat(formattingOptions);
 
             // field object to be set
             Object modelField = model.get(field.getDeclaringClass().getName());
@@ -345,7 +352,11 @@ public class BindyFixedLengthFactory extends 
BindyAbstractFactory implements Bin
                     Class<?> type = field.getType();
 
                     // Create format
-                    Format<?> format = FormatFactory.getFormat(type, 
getLocale(), datafield, field.getAnnotation(BindyConverter.class));
+                    FormattingOptions formattingOptions = 
ConverterUtils.convert(datafield,
+                            field.getType(),
+                            field.getAnnotation(BindyConverter.class),
+                            getLocale());
+                    Format<?> format = 
formatFactory.getFormat(formattingOptions);
 
                     // Get field value
                     Object value = field.get(obj);

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
index 6625be0..5985939 100644
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 public class BindyKeyValuePairFactory extends BindyAbstractFactory implements 
BindyFactory {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(BindyKeyValuePairFactory.class);
+    private final FormatFactory formatFactory = FormatFactory.getInstance();
 
     private Map<Integer, KeyValuePairField> keyValuePairFields = new 
LinkedHashMap<Integer, KeyValuePairField>();
     private Map<Integer, Field> annotatedFields = new LinkedHashMap<Integer, 
Field>();
@@ -232,7 +233,7 @@ public class BindyKeyValuePairFactory extends 
BindyAbstractFactory implements Bi
 
                         if (l != null) {
 
-                            // Test if object exist
+                            // BigIntegerFormatFactory if object exist
                             if (!l.isEmpty()) {
                                 obj = l.get(0);
                             } else {
@@ -279,7 +280,11 @@ public class BindyKeyValuePairFactory extends 
BindyAbstractFactory implements Bi
                             if (value != null) {
 
                                 // Create format object to format the field
-                                Format<?> format = 
FormatFactory.getFormat(field.getType(), getLocale(), keyValuePairField, 
field.getAnnotation(BindyConverter.class));
+                                FormattingOptions formattingOptions = 
ConverterUtils.convert(keyValuePairField,
+                                        field.getType(),
+                                        
field.getAnnotation(BindyConverter.class),
+                                        getLocale());
+                                Format<?> format = 
formatFactory.getFormat(formattingOptions);
 
                                 // format the value of the key received
                                 result = formatField(format, value, key, line);
@@ -305,7 +310,7 @@ public class BindyKeyValuePairFactory extends 
BindyAbstractFactory implements Bi
                                 // Relation OneToMany
                                 for (int i = 0; i < values.size(); i++) {
 
-                                    // Test if object exist
+                                    // BigIntegerFormatFactory if object exist
                                     if ((!l.isEmpty()) && (l.size() > i)) {
                                         obj = l.get(i);
                                     } else {
@@ -315,7 +320,11 @@ public class BindyKeyValuePairFactory extends 
BindyAbstractFactory implements Bi
                                     value = values.get(i);
 
                                     // Create format object to format the field
-                                    Format<?> format = 
FormatFactory.getFormat(field.getType(), getLocale(), keyValuePairField, 
field.getAnnotation(BindyConverter.class));
+                                    FormattingOptions formattingOptions = 
ConverterUtils.convert(keyValuePairField,
+                                            field.getType(),
+                                            
field.getAnnotation(BindyConverter.class),
+                                            getLocale());
+                                    Format<?> format = 
formatFactory.getFormat(formattingOptions);
 
                                     // format the value of the key received
                                     Object result = formatField(format, value, 
key, line);
@@ -444,7 +453,11 @@ public class BindyKeyValuePairFactory extends 
BindyAbstractFactory implements Bi
 
             // Create format
             @SuppressWarnings("unchecked")
-            Format<Object> format = 
(Format<Object>)FormatFactory.getFormat(type, getLocale(), keyValuePairField, 
field.getAnnotation(BindyConverter.class));
+            FormattingOptions formattingOptions = 
ConverterUtils.convert(keyValuePairField,
+                    field.getType(),
+                    field.getAnnotation(BindyConverter.class),
+                    getLocale());
+            Format<Object> format = (Format<Object>) 
formatFactory.getFormat(formattingOptions);
 
             // Get object to be formatted
             Object obj = model.get(field.getDeclaringClass().getName());
@@ -618,7 +631,7 @@ public class BindyKeyValuePairFactory extends 
BindyAbstractFactory implements Bi
                 }
 
                 if (section != null) {
-                    // Test if section number is not null
+                    // BigIntegerFormatFactory if section number is not null
                     ObjectHelper.notNull(section.number(), "No number has been 
defined for the section");
 
                     // Get section number and add it to the sections

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/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 1971012..b9e374a 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
@@ -17,41 +17,30 @@
 package org.apache.camel.dataformat.bindy;
 
 
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.util.Date;
-import java.util.Locale;
-
-import org.apache.camel.dataformat.bindy.annotation.BindyConverter;
-import org.apache.camel.dataformat.bindy.annotation.DataField;
-import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField;
-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.LocalDatePatternFormat;
-import org.apache.camel.dataformat.bindy.format.LocalDateTimePatternFormat;
-import org.apache.camel.dataformat.bindy.format.LocalTimePatternFormat;
-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;
+import 
org.apache.camel.dataformat.bindy.format.factories.BigDecimalFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.BigDecimalPatternFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.BigIntegerFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.BooleanFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.ByteFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.BytePatternFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.CharacterFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.DateFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.DoubleFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.DoublePatternFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.EnumFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.FloatFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.FloatPatternFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.FormatFactories;
+import org.apache.camel.dataformat.bindy.format.factories.IntegerFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.IntegerPatternFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.LocalDateFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.LocalDateTimeFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.LocalTimeFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.LongFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.LongPatternFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.ShortFormatFactory;
+import 
org.apache.camel.dataformat.bindy.format.factories.ShortPatternFormatFactory;
+import org.apache.camel.dataformat.bindy.format.factories.StringFormatFactory;
 
 
 /**
@@ -59,137 +48,55 @@ import org.apache.camel.util.ObjectHelper;
  */
 public final class FormatFactory {
 
-    private FormatFactory() {
+    private static final FormatFactory INSTANCE = new FormatFactory();
+
+    static {
+        FormatFactories.getInstance()
+                .register(new StringFormatFactory())
+                .register(new DateFormatFactory())
+                .register(new BooleanFormatFactory())
+                .register(new BigIntegerFormatFactory())
+                .register(new LocalTimeFormatFactory())
+                .register(new LocalDateTimeFormatFactory())
+                .register(new LocalDateFormatFactory())
+                .register(new CharacterFormatFactory())
+                .register(new EnumFormatFactory())
+                .register(new BigDecimalFormatFactory())
+                .register(new BigDecimalPatternFormatFactory())
+                .register(new DoubleFormatFactory())
+                .register(new DoublePatternFormatFactory())
+                .register(new FloatFormatFactory())
+                .register(new FloatPatternFormatFactory())
+                .register(new LongFormatFactory())
+                .register(new LongPatternFormatFactory())
+                .register(new IntegerFormatFactory())
+                .register(new IntegerPatternFormatFactory())
+                .register(new ShortFormatFactory())
+                .register(new ShortPatternFormatFactory())
+                .register(new ByteFormatFactory())
+                .register(new BytePatternFormatFactory());
     }
 
-    /**
-     * Retrieves the format to use for the given type
-     *
-     * @param clazz represents the type of the format (String, Integer, Byte)
-     * @param pattern is the pattern to be used during the formatting of the 
data
-     * @param locale optional locale for NumberFormat and DateFormat parsing.
-     * @param precision optional scale for BigDecimal parsing.
-     * @param rounding optional rounding mode to be used to scale BigDecimal 
with precision value
-     * @param impliedDecimalSeparator optional flag for floating-point values
-     * @param decimalSeparator optional decimal separator for BigDecimal
-     * @param groupingSeparator optional grouping separator for BigDecimal
-     * @return Format the formatter
-     * @throws IllegalArgumentException if not suitable formatter is found
-     */
-    private static Format<?> doGetFormat(Class<?> clazz, String pattern, 
String locale,
-                                         String timezone, int precision, 
String rounding,
-                                         boolean impliedDecimalSeparator, 
String decimalSeparator, String groupingSeparator)
-        throws Exception {
-        if (clazz == byte.class || clazz == Byte.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new BytePatternFormat(pattern, getLocale(locale))
-                : new ByteFormat();
-        } else if (clazz == short.class || clazz == Short.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new ShortPatternFormat(pattern, getLocale(locale))
-                : new ShortFormat();
-        } else if (clazz == int.class || clazz == Integer.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new IntegerPatternFormat(pattern, getLocale(locale))
-                : new IntegerFormat();
-        } else if (clazz == long.class || clazz == Long.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new LongPatternFormat(pattern, getLocale(locale))
-                : new LongFormat();
-        } else if (clazz == float.class || clazz == Float.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new FloatPatternFormat(pattern, getLocale(locale))
-                : new FloatFormat(impliedDecimalSeparator, precision, 
getLocale(locale));
-        } else if (clazz == double.class || clazz == Double.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new DoublePatternFormat(pattern, getLocale(locale))
-                : new DoubleFormat(impliedDecimalSeparator, precision, 
getLocale(locale));
-        } else if (clazz == BigDecimal.class) {
-            return ObjectHelper.isNotEmpty(pattern)
-                ? new BigDecimalPatternFormat(pattern, getLocale(locale), 
precision, rounding, decimalSeparator, groupingSeparator)
-                : new BigDecimalFormat(impliedDecimalSeparator, precision, 
getLocale(locale));
-        } else if (clazz == BigInteger.class) {
-            return new BigIntegerFormat();
-        } else if (clazz == String.class) {
-            return new StringFormat();
-        } else if (clazz == Date.class) {
-            return new DatePatternFormat(pattern, timezone, getLocale(locale));
-        } else if (clazz == char.class || clazz == Character.class) {
-            return new CharacterFormat();
-        } else if (clazz == boolean.class || clazz == Boolean.class) {
-            return new BooleanFormat();
-        } else if (clazz == LocalDate.class) {
-            return new LocalDatePatternFormat(pattern, getLocale(locale));
-        } else if (clazz == LocalDateTime.class) {
-            return new LocalDateTimePatternFormat(pattern, timezone, 
getLocale(locale));
-        } else if (clazz == LocalTime.class) {
-            return new LocalTimePatternFormat(pattern, timezone, 
getLocale(locale));
-        } else if (clazz.isEnum()) {
-            @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());
-        }
+    private FormatFactory() {
     }
 
-    /**
-     * Retrieves the format to use for the given type
-     *
-     * @param clazz represents the type of the format (String, Integer, Byte)
-     * @param locale optional locale for NumberFormat and DateFormat parsing.
-     * @return Format the formatter
-     * @throws IllegalArgumentException if not suitable formatter is found
-     */
-    public static Format<?> getFormat(Class<?> clazz, String locale, DataField 
data, BindyConverter converter) throws Exception {
-        if (converter != null) {
-            return converter.value().newInstance();
-        }
-
-        String pattern = data.pattern();
-        String timezone = data.timezone();
-        int precision = data.precision();
-        String decimalSeparator = data.decimalSeparator();
-        String groupingSeparator = data.groupingSeparator();
-        String rounding = data.rounding();
+    public static FormatFactory getInstance() {
+        return INSTANCE;
+    }
 
-        return doGetFormat(clazz, pattern, locale, timezone, precision, 
rounding, data.impliedDecimalSeparator(), decimalSeparator, groupingSeparator);
+    private Format<?> doGetFormat(FormattingOptions formattingOptions) {
+        return FormatFactories.getInstance().build(formattingOptions);
     }
 
     /**
-     * Retrieves the format to use for the given type
-     *
-     * @param clazz represents the type of the format (String, Integer, Byte)
-     * @param locale optional locale for NumberFormat and DateFormat parsing.
-     * @return Format the formatter
-     * @throws IllegalArgumentException if not suitable formatter is found
-     * TODO : Check if KeyValuePair could also use 
decimal/groupingSeparator/rounding for BigDecimal
+     * Retrieves the format to use for the given type*
      */
-    public static Format<?> getFormat(Class<?> clazz, String locale, 
KeyValuePairField data, BindyConverter converter) throws Exception {
-        if (converter != null) {
-            return converter.value().newInstance();
-        }
-
-        String pattern = data.pattern();
-        String timezone = data.timezone();
-        int precision = data.precision();
-
-        return doGetFormat(clazz, pattern, locale, timezone, precision, null, 
data.impliedDecimalSeparator(), null, null);
-    }
-
-    private static Locale getLocale(String locale) {
-        if ("default".equals(locale)) {
-            return Locale.getDefault();
+    public Format<?> getFormat(FormattingOptions formattingOptions) throws 
Exception {
+        if (formattingOptions.getBindyConverter() != null) {
+            return formattingOptions.getBindyConverter().value().newInstance();
         }
 
-        Locale answer = null;
-        if (ObjectHelper.isNotEmpty(locale)) {
-            String[] result = locale.split("-");
-            if (result.length <= 2) {
-                answer = result.length == 1 ? new Locale(result[0]) : new 
Locale(result[0], result[1]);
-            }
-        }
-        return answer;
+        return doGetFormat(formattingOptions);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormattingOptions.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormattingOptions.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormattingOptions.java
new file mode 100644
index 0000000..9f154a7
--- /dev/null
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormattingOptions.java
@@ -0,0 +1,139 @@
+/**
+ * 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;
+
+import java.util.Locale;
+import org.apache.camel.dataformat.bindy.annotation.BindyConverter;
+import org.apache.camel.util.ObjectHelper;
+
+public class FormattingOptions {
+    private String pattern;
+    private Locale locale;
+    private String timezone;
+    private int precision;
+    private String rounding;
+    private boolean impliedDecimalSeparator;
+    private String decimalSeparator;
+    private String groupingSeparator;
+    private Class<?> clazz;
+    private BindyConverter bindyConverter;
+
+    public String getPattern() {
+        return pattern;
+    }
+
+    public Locale getLocale() {
+        return locale;
+    }
+
+    public String getTimezone() {
+        return timezone;
+    }
+
+    public int getPrecision() {
+        return precision;
+    }
+
+    public String getRounding() {
+        return rounding;
+    }
+
+    public boolean isImpliedDecimalSeparator() {
+        return impliedDecimalSeparator;
+    }
+
+    public String getDecimalSeparator() {
+        return decimalSeparator;
+    }
+
+    public String getGroupingSeparator() {
+        return groupingSeparator;
+    }
+
+    public FormattingOptions withPattern(String pattern) {
+        this.pattern = pattern;
+        return this;
+    }
+
+    public FormattingOptions withLocale(String locale) {
+        this.locale = getLocale(locale);
+        return this;
+    }
+
+    public FormattingOptions withTimezone(String timezone) {
+        this.timezone = timezone;
+        return this;
+    }
+
+    public FormattingOptions withPrecision(int precision) {
+        this.precision = precision;
+        return this;
+    }
+
+    public FormattingOptions withRounding(String rounding) {
+        this.rounding = rounding;
+        return this;
+    }
+
+    public FormattingOptions withImpliedDecimalSeparator(boolean 
impliedDecimalSeparator) {
+        this.impliedDecimalSeparator = impliedDecimalSeparator;
+        return this;
+    }
+
+    public FormattingOptions withDecimalSeparator(String decimalSeparator) {
+        this.decimalSeparator = decimalSeparator;
+        return this;
+    }
+
+    public FormattingOptions withGroupingSeparator(String groupingSeparator) {
+        this.groupingSeparator = groupingSeparator;
+        return this;
+    }
+
+    public FormattingOptions forClazz(Class<?> clazz) {
+        this.clazz = clazz;
+        return this;
+    }
+
+    public Class<?> getClazz() {
+        return clazz;
+    }
+
+    private Locale getLocale(String locale) {
+        if ("default".equals(locale)) {
+            return Locale.getDefault();
+        }
+
+        Locale answer = null;
+        if (ObjectHelper.isNotEmpty(locale)) {
+            String[] result = locale.split("-");
+            if (result.length <= 2) {
+                answer = result.length == 1 ? new Locale(result[0]) : new 
Locale(result[0], result[1]);
+            }
+        }
+        return answer;
+    }
+
+    public FormattingOptions withBindyConverter(BindyConverter bindyConverter) 
{
+        this.bindyConverter = bindyConverter;
+        return this;
+    }
+
+    public BindyConverter getBindyConverter() {
+        return bindyConverter;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index e88e6ea..1622064 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -190,7 +190,7 @@ public class BindyCsvDataFormat extends 
BindyAbstractDataFormat {
                 }
             }
 
-            // Test if models list is empty or not
+            // BigIntegerFormatFactory if models list is empty or not
             // If this is the case (correspond to an empty stream, ...)
             if (models.size() == 0) {
                 throw new java.lang.IllegalArgumentException("No records have 
been defined in the CSV");

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
index af8f6a3..ffbed62 100644
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
@@ -237,7 +237,7 @@ public class BindyFixedLengthDataFormat extends 
BindyAbstractDataFormat {
                 }
             }
 
-            // Test if models list is empty or not
+            // BigIntegerFormatFactory if models list is empty or not
             // If this is the case (correspond to an empty stream, ...)
             if (models.size() == 0) {
                 throw new java.lang.IllegalArgumentException("No records have 
been defined in the the file");

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
deleted file mode 100755
index defba11..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.util.Locale;
-
-
-public class BigDecimalFormat extends AbstractNumberFormat<BigDecimal> {
-
-    public BigDecimalFormat(boolean impliedDecimalPosition, int precision, 
Locale locale) {
-        super(impliedDecimalPosition, precision, locale);
-    }
-
-    public String format(BigDecimal object) throws Exception {
-        return !super.hasImpliedDecimalPosition()
-            ? super.getFormat().format(object)
-            : super.getFormat().format(object.multiply(new 
BigDecimal(super.getMultiplier())));
-    }
-
-    public BigDecimal parse(String string) throws Exception {
-        BigDecimal result = new BigDecimal(string.trim());
-        if (super.hasImpliedDecimalPosition()) {
-            result = result.divide(new BigDecimal(super.getMultiplier()), 
super.getPrecision(), RoundingMode.HALF_EVEN);
-        } else {
-            if (super.getPrecision() != -1) {
-                result = result.setScale(super.getPrecision());
-            }
-        }
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/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
deleted file mode 100644
index ba208b8..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalPatternFormat.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class BigDecimalPatternFormat extends NumberPatternFormat<BigDecimal> {
-
-    public BigDecimalPatternFormat() {
-    }
-
-    public BigDecimalPatternFormat(String pattern, Locale locale, int 
precision, String rounding, String decimalSeparator, String groupingSeparator) {
-        super(pattern, locale, precision, rounding, decimalSeparator, 
groupingSeparator);
-    }
-
-    @Override
-    public BigDecimal parse(String string) throws Exception {
-        if (getNumberFormat() != null) {
-            DecimalFormat df = (DecimalFormat)getNumberFormat();
-            df.setParseBigDecimal(true);
-            BigDecimal bd = (BigDecimal)df.parse(string.trim());
-            if (super.getPrecision() != -1) {
-                bd = bd.setScale(super.getPrecision(), 
RoundingMode.valueOf(super.getRounding()));
-            }
-            return bd;
-        } else {
-            return new BigDecimal(string.trim());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigIntegerFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigIntegerFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigIntegerFormat.java
deleted file mode 100755
index 42e6ae0..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigIntegerFormat.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.BigInteger;
-
-public class BigIntegerFormat extends AbstractNumberFormat<BigInteger> {
-
-    public String format(BigInteger object) throws Exception {
-        return object.toString();
-    }
-
-    public BigInteger parse(String string) throws Exception {
-        return new BigInteger(string);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
deleted file mode 100755
index ac0955f..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BooleanFormat.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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 org.apache.camel.dataformat.bindy.Format;
-
-public class BooleanFormat implements Format<Boolean> {
-
-    public String format(Boolean object) throws Exception {
-        return object.toString();
-    }
-
-    public Boolean parse(String string) throws Exception {
-        return Boolean.valueOf(string);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ByteFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ByteFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ByteFormat.java
deleted file mode 100755
index fc87544..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ByteFormat.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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 org.apache.camel.dataformat.bindy.Format;
-
-public class ByteFormat implements Format<Byte> {
-
-    public String format(Byte object) throws Exception {
-        return object.toString();
-    }
-
-    public Byte parse(String string) throws Exception {
-        return new Byte(string);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BytePatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BytePatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BytePatternFormat.java
deleted file mode 100755
index d04f869..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BytePatternFormat.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class BytePatternFormat extends NumberPatternFormat<Byte> {
-
-    public BytePatternFormat() {
-    }
-
-    public BytePatternFormat(String pattern, Locale locale) {
-        super(pattern, locale);
-    }
-
-    @Override
-    public Byte parse(String string) throws Exception {
-        if (getNumberFormat() != null) {
-            return getNumberFormat().parse(string).byteValue();
-        } else {
-            return Byte.valueOf(string);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/CharacterFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/CharacterFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/CharacterFormat.java
deleted file mode 100755
index 7f37d75..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/CharacterFormat.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.text.ParseException;
-
-import org.apache.camel.dataformat.bindy.Format;
-
-public class CharacterFormat implements Format<Character> {
-
-    public String format(Character object) throws Exception {
-        return object.toString();
-    }
-
-    public Character parse(String string) throws Exception {
-        if (string.length() > 1) {
-            throw new ParseException("The string \"" + string + "\" cannot be 
parsed to a character (size > 1).", 1);
-        }
-        return string.charAt(0);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DatePatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DatePatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DatePatternFormat.java
deleted file mode 100755
index dbf1bb1..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DatePatternFormat.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import org.apache.camel.dataformat.bindy.PatternFormat;
-import org.apache.camel.util.ObjectHelper;
-
-public class DatePatternFormat implements PatternFormat<Date> {
-
-    private String pattern;
-    private Locale locale;
-    private TimeZone timezone;
-
-    public DatePatternFormat() {
-    }
-
-    public DatePatternFormat(String pattern, Locale locale) {
-        this.pattern = pattern;
-        this.locale = locale;
-    }
-
-    public DatePatternFormat(String pattern, String timezone, Locale locale) {
-        this.pattern = pattern;
-        this.locale = locale;
-        if (!timezone.isEmpty()) {
-            this.timezone = TimeZone.getTimeZone(timezone);
-        }
-    }
-
-    public String format(Date object) throws Exception {
-        ObjectHelper.notNull(this.pattern, "pattern");
-        return this.getDateFormat().format(object);
-    }
-
-    public Date parse(String string) throws Exception {
-
-        Date date;
-        DateFormat df = this.getDateFormat();
-
-        ObjectHelper.notNull(this.pattern, "pattern");
-
-        // Check length of the string with date pattern
-        // To avoid to parse a string date : 20090901-10:32:30 when
-        // the pattern is yyyyMMdd
-
-        if (string.length() <= this.pattern.length()) {
-
-            // Force the parser to be strict in the syntax of the date to be
-            // converted
-            df.setLenient(false);
-            date = df.parse(string);
-
-            return date;
-
-        } else {
-            throw new FormatException("Date provided does not fit the pattern 
defined");
-        }
-
-    }
-
-    protected java.text.DateFormat getDateFormat() {
-        SimpleDateFormat result;
-        if (locale != null) {
-            result = new SimpleDateFormat(pattern, locale);
-        } else {
-            result = new SimpleDateFormat(pattern);
-        }
-        if (timezone != null) {
-            result.setTimeZone(timezone);
-        }
-        return result;
-    }
-
-    public String getPattern() {
-        return pattern;
-    }
-
-    /**
-     * Sets the pattern
-     * 
-     * @param pattern the pattern
-     */
-    public void setPattern(String pattern) {
-        this.pattern = pattern;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoubleFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoubleFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoubleFormat.java
deleted file mode 100755
index 4986365..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoubleFormat.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class DoubleFormat extends AbstractNumberFormat<Double> {
-
-    public DoubleFormat(boolean impliedDecimalPosition, int precision, Locale 
locale) {
-        super(impliedDecimalPosition, precision, locale);
-    }
-
-    public String format(Double object) throws Exception {
-        return !super.hasImpliedDecimalPosition()
-            ? super.getFormat().format(object)
-            : super.getFormat().format(object * super.getMultiplier());
-    }
-
-    public Double parse(String string) throws Exception {
-        Double value = null;
-        if (!super.hasImpliedDecimalPosition()) {
-            value = Double.parseDouble(string.trim());
-        } else {
-            BigDecimal tmp = new BigDecimal(string.trim());
-            BigDecimal div = BigDecimal.valueOf(super.getMultiplier());
-            value = tmp.divide(div).doubleValue();
-        }
-
-        return value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoublePatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoublePatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoublePatternFormat.java
deleted file mode 100755
index 3318934..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DoublePatternFormat.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class DoublePatternFormat extends NumberPatternFormat<Double> {
-
-    public DoublePatternFormat() {
-    }
-
-    public DoublePatternFormat(String pattern, Locale locale) {
-        super(pattern, locale);
-    }
-
-    @Override
-    public Double parse(String string) throws Exception {
-        if (getNumberFormat() != null) {
-            return getNumberFormat().parse(string).doubleValue();
-        } else {
-            return Double.valueOf(string);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/EnumFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/EnumFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/EnumFormat.java
deleted file mode 100644
index 4245222..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/EnumFormat.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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 org.apache.camel.dataformat.bindy.Format;
-
-public class EnumFormat<T extends Enum<T>> implements Format<T> {
-
-    private final Class<T> clazz;
-
-    public EnumFormat(Class<T> clazz) {
-        this.clazz = clazz;
-    }
-
-    public String format(final T object) throws Exception {
-        return object.name();
-    }
-
-    public T parse(final String string) throws Exception {
-        return Enum.valueOf(clazz, string);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatFormat.java
deleted file mode 100755
index 6540d0e..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatFormat.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class FloatFormat extends AbstractNumberFormat<Float> {
-
-    public FloatFormat(boolean impliedDecimalPosition, int precision, Locale 
locale) {
-        super(impliedDecimalPosition, precision, locale);
-    }
-
-    public String format(Float object) throws Exception {
-        return !super.hasImpliedDecimalPosition()
-            ? super.getFormat().format(object)
-            : super.getFormat().format(object * super.getMultiplier());
-    }
-
-    public Float parse(String string) throws Exception {
-        Float value = null;
-        if (!super.hasImpliedDecimalPosition()) {
-            value = Float.parseFloat(string.trim());
-        } else {
-            BigDecimal tmp = new BigDecimal(string.trim());
-            BigDecimal div = BigDecimal.valueOf(super.getMultiplier());
-            value = tmp.divide(div).floatValue();
-        }
-
-        return value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatPatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatPatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatPatternFormat.java
deleted file mode 100755
index dbe351e..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/FloatPatternFormat.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class FloatPatternFormat extends NumberPatternFormat<Float> {
-
-    public FloatPatternFormat() {
-    }
-
-    public FloatPatternFormat(String pattern, Locale locale) {
-        super(pattern, locale);
-    }
-
-    @Override
-    public Float parse(String string) throws Exception {
-        if (getNumberFormat() != null) {
-            return getNumberFormat().parse(string).floatValue();
-        } else {
-            return Float.valueOf(string);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerFormat.java
deleted file mode 100755
index 5d1c0b4..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerFormat.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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;
-
-
-public class IntegerFormat extends AbstractNumberFormat<Integer> {
-
-    public String format(Integer object) throws Exception {
-        return object.toString();
-    }
-
-    public Integer parse(String string) throws Exception {
-        return new Integer(string);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerPatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerPatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerPatternFormat.java
deleted file mode 100755
index 3963830..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerPatternFormat.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class IntegerPatternFormat extends NumberPatternFormat<Integer> {
-
-    public IntegerPatternFormat() {
-    }
-
-    public IntegerPatternFormat(String pattern, Locale locale) {
-        super(pattern, locale);
-    }
-
-    @Override
-    public Integer parse(String string) throws Exception {
-        if (getNumberFormat() != null) {
-            return getNumberFormat().parse(string).intValue();
-        } else {
-            return Integer.valueOf(string);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDatePatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDatePatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDatePatternFormat.java
deleted file mode 100644
index 0b4daee..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDatePatternFormat.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.util.Locale;
-import org.apache.camel.dataformat.bindy.PatternFormat;
-import org.apache.camel.util.ObjectHelper;
-
-public class LocalDatePatternFormat implements PatternFormat<LocalDate> {
-
-    private String pattern;
-    private Locale locale;
-
-    public LocalDatePatternFormat() {
-    }
-
-    public LocalDatePatternFormat(String pattern, Locale locale) {
-        this.pattern = pattern;
-        this.locale = locale;
-    }
-
-    public String format(LocalDate object) throws Exception {
-        ObjectHelper.notNull(this.pattern, "pattern");
-        return this.getDateFormat().format(object);
-    }
-
-    public LocalDate parse(String string) throws Exception {
-
-        LocalDate date;
-        DateTimeFormatter df = this.getDateFormat();
-
-        ObjectHelper.notNull(this.pattern, "pattern");
-
-        if (doesStringFitLengthOfPattern(string)) {
-            date = LocalDate.parse(string, df);
-            return date;
-        } else {
-            throw new FormatException("Date provided does not fit the pattern 
defined");
-        }
-
-    }
-
-    private boolean doesStringFitLengthOfPattern(String string) {
-        return string.length() <= this.pattern.length();
-    }
-
-    protected DateTimeFormatter getDateFormat() {
-        DateTimeFormatter result;
-        if (locale != null) {
-            result = DateTimeFormatter.ofPattern(pattern, locale);
-        } else {
-            result = DateTimeFormatter.ofPattern(pattern);
-        }
-        return result;
-    }
-
-    public String getPattern() {
-        return pattern;
-    }
-
-    /**
-     * Sets the pattern
-     * 
-     * @param pattern the pattern
-     */
-    public void setPattern(String pattern) {
-        this.pattern = pattern;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDateTimePatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDateTimePatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDateTimePatternFormat.java
deleted file mode 100644
index 62a0399..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalDateTimePatternFormat.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.Locale;
-import org.apache.camel.dataformat.bindy.PatternFormat;
-import org.apache.camel.util.ObjectHelper;
-
-public class LocalDateTimePatternFormat implements 
PatternFormat<LocalDateTime> {
-
-    private String pattern;
-    private Locale locale;
-    private ZoneId zone;
-
-    public LocalDateTimePatternFormat() {
-    }
-
-    public LocalDateTimePatternFormat(String pattern, String timezone, Locale 
locale) {
-        this.pattern = pattern;
-        this.locale = locale;
-        if (timezone.isEmpty()) {
-            this.zone = ZoneId.systemDefault();
-        } else {
-            this.zone = ZoneId.of(timezone);
-        }
-    }
-
-    public String format(LocalDateTime object) throws Exception {
-        ObjectHelper.notNull(this.pattern, "pattern");
-        return this.getDateFormat().format(object);
-    }
-
-    public LocalDateTime parse(String string) throws Exception {
-
-        LocalDateTime date;
-        DateTimeFormatter df = this.getDateFormat();
-
-        ObjectHelper.notNull(this.pattern, "pattern");
-
-        if (doesStringFitLengthOfPattern(string)) {
-            date = LocalDateTime.parse(string, df);
-            return date;
-        } else {
-            throw new FormatException("Date provided does not fit the pattern 
defined");
-        }
-
-    }
-
-    private boolean doesStringFitLengthOfPattern(String string) {
-        return string.length() <= this.pattern.length();
-    }
-
-    protected DateTimeFormatter getDateFormat() {
-        DateTimeFormatter result;
-        if (locale != null) {
-            result = DateTimeFormatter.ofPattern(pattern, locale)
-                    .withZone(zone);
-        } else {
-            result = DateTimeFormatter.ofPattern(pattern)
-                    .withZone(zone);
-        }
-        return result;
-    }
-
-    public String getPattern() {
-        return pattern;
-    }
-
-    /**
-     * Sets the pattern
-     *
-     * @param pattern the pattern
-     */
-    public void setPattern(String pattern) {
-        this.pattern = pattern;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalTimePatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalTimePatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalTimePatternFormat.java
deleted file mode 100644
index dbab92f..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LocalTimePatternFormat.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * 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.time.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.Locale;
-import org.apache.camel.dataformat.bindy.PatternFormat;
-import org.apache.camel.util.ObjectHelper;
-
-
-public class LocalTimePatternFormat implements PatternFormat<LocalTime> {
-
-    private String pattern;
-    private Locale locale;
-    private ZoneId zone;
-
-    public LocalTimePatternFormat() {
-    }
-
-    public LocalTimePatternFormat(String pattern, String timezone, Locale 
locale) {
-        this.pattern = pattern;
-        this.locale = locale;
-        if (timezone.isEmpty()) {
-            this.zone = ZoneId.systemDefault();
-        } else {
-            this.zone = ZoneId.of(timezone);
-        }
-    }
-
-    public String format(LocalTime object) throws Exception {
-        ObjectHelper.notNull(this.pattern, "pattern");
-        return this.getDateFormat().format(object);
-    }
-
-    public LocalTime parse(String string) throws Exception {
-
-        LocalTime date;
-        DateTimeFormatter df = this.getDateFormat();
-
-        ObjectHelper.notNull(this.pattern, "pattern");
-
-        if (doesStringFitLengthOfPattern(string)) {
-            date = LocalTime.parse(string, df);
-            return date;
-        } else {
-            throw new FormatException("Date provided does not fit the pattern 
defined");
-        }
-
-    }
-
-    private boolean doesStringFitLengthOfPattern(String string) {
-        return string.length() <= this.pattern.length();
-    }
-
-    protected DateTimeFormatter getDateFormat() {
-        DateTimeFormatter result;
-        if (locale != null) {
-            result = DateTimeFormatter.ofPattern(pattern, locale)
-                    .withZone(zone);
-        } else {
-            result = DateTimeFormatter.ofPattern(pattern)
-                    .withZone(zone);
-        }
-        return result;
-    }
-
-    public String getPattern() {
-        return pattern;
-    }
-
-    /**
-     * Sets the pattern
-     *
-     * @param pattern the pattern
-     */
-    public void setPattern(String pattern) {
-        this.pattern = pattern;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongFormat.java
deleted file mode 100755
index 82b6fa6..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongFormat.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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;
-
-
-public class LongFormat extends AbstractNumberFormat<Long> {
-
-    public String format(Long object) throws Exception {
-        return object.toString();
-    }
-
-    public Long parse(String string) throws Exception {
-        return new Long(string);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongPatternFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongPatternFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongPatternFormat.java
deleted file mode 100755
index 9049e2d..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/LongPatternFormat.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.util.Locale;
-
-public class LongPatternFormat extends NumberPatternFormat<Long> {
-
-    public LongPatternFormat() {
-    }
-
-    public LongPatternFormat(String pattern, Locale locale) {
-        super(pattern, locale);
-    }
-
-    @Override
-    public Long parse(String string) throws Exception {
-        if (getNumberFormat() != null) {
-            return getNumberFormat().parse(string).longValue();
-        } else {
-            return Long.valueOf(string);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/311d429c/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ShortFormat.java
----------------------------------------------------------------------
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ShortFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ShortFormat.java
deleted file mode 100755
index 62bb103..0000000
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/ShortFormat.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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;
-
-
-public class ShortFormat extends AbstractNumberFormat<Short> {
-
-    public String format(Short object) throws Exception {
-        return object.toString();
-    }
-
-    public Short parse(String string) throws Exception {
-        return new Short(string);
-    }
-
-}

Reply via email to