camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulli...@apache.org
Subject svn commit: r882639 [1/3] - in /camel/trunk/components/camel-bindy/src: main/java/org/apache/camel/dataformat/bindy/ main/java/org/apache/camel/dataformat/bindy/annotation/ main/java/org/apache/camel/dataformat/bindy/csv/ main/java/org/apache/camel/dat...
Date Fri, 20 Nov 2009 16:55:05 GMT
Author: cmoulliard
Date: Fri Nov 20 16:54:46 2009
New Revision: 882639

URL: http://svn.apache.org/viewvc?rev=882639&view=rev
Log:
Apply PsourceCheck (use now CamelCodeFormatter.xml in Eclipse)

Modified:
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/Format.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/PatternFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/KeyValuePairField.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/OneToMany.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Section.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/DatePatternFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/IntegerPatternFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/NumberPatternFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
    camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/util/Converter.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/CommonBindyTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvGenerateHeaderMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvGenerateHeaderMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMandatoryFieldsUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallDslTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallPositionModifiedTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvOneToManyMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvSkipFirstLineUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallBadIntegerTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallDslTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallPositionModifiedTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallDslTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairNullMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabMarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/generateheader/Client.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/generateheader/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/generateheader/Security.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Client.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/complex/twoclassesandonelink/Security.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/complex/onetomany/Header.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/complex/onetomany/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/complex/onetomany/Security.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/complex/onetomany/Trailer.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/simple/Header.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/simple/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/simple/Trailer.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/body/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/header/Header.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/sorted/trailer/Trailer.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/tab/Header.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/tab/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/fix/tab/Trailer.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassandskipfirstline/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassdifferentposition/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassgenerateheader/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassmandatory/Order.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/onetomany/Author.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/onetomany/Book.java
    camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/util/AnnotationModuleLoaderTest.java

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java Fri Nov 20 16:54:46 2009
@@ -50,9 +50,9 @@
         this.packageNames = packageNames;
 
         if (LOG.isDebugEnabled()) {
-        	for (String str : this.packageNames) {
-        		LOG.debug("Package name : " + str);
-        	}
+            for (String str : this.packageNames) {
+                LOG.debug("Package name : " + str);
+            }
         }
 
         initModel();

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java Fri Nov 20 16:54:46 2009
@@ -48,12 +48,14 @@
 
     private static final transient Log LOG = LogFactory.getLog(BindyCsvFactory.class);
 
+    boolean isOneToMany;
+
     private Map<Integer, DataField> dataFields = new LinkedHashMap<Integer, DataField>();
     private Map<Integer, Field> annotedFields = new LinkedHashMap<Integer, Field>();
     private Map<String, Integer> sections = new HashMap<String, Integer>();
-    
-    private Map<Integer, List> results; 
-    
+
+    private Map<Integer, List> results;
+
     private int numberOptionalFields;
     private int numberMandatoryFields;
     private int totalFields;
@@ -62,8 +64,6 @@
     private boolean skipFirstLine;
     private boolean generateHeaderColumnNames;
     private boolean messageOrdered;
-    
-	boolean isOneToMany = false;
 
     public BindyCsvFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
         super(resolver, packageNames);
@@ -74,9 +74,9 @@
 
     /**
      * method uses to initialize the model representing the classes who will
-     * bind the data. This process will scan for classes according to the package
-     * name provided, check the annotated classes and fields and retrieve the
-     * separator of the CSV record
+     * bind the data. This process will scan for classes according to the
+     * package name provided, check the annotated classes and fields and
+     * retrieve the separator of the CSV record
      * 
      * @throws Exception
      */
@@ -104,16 +104,15 @@
                 DataField dataField = field.getAnnotation(DataField.class);
                 if (dataField != null) {
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug("Position defined in the class : " + cl.getName() + ", position : "
-                                  + dataField.pos() + ", Field : " + dataField.toString());
+                        LOG.debug("Position defined in the class : " + cl.getName() + ", position : " + dataField.pos() + ", Field : " + dataField.toString());
                     }
-                    
+
                     if (dataField.required()) {
                         ++numberMandatoryFields;
                     } else {
                         ++numberOptionalFields;
                     }
-                    
+
                     dataFields.put(dataField.pos(), dataField);
                     annotedFields.put(dataField.pos(), field);
                 }
@@ -132,15 +131,15 @@
             if (!linkFields.isEmpty()) {
                 annotedLinkFields.put(cl.getName(), linkFields);
             }
-            
+
             totalFields = numberMandatoryFields + numberOptionalFields;
-            
+
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Number of optional fields : " + numberOptionalFields);
                 LOG.debug("Number of mandatory fields : " + numberMandatoryFields);
                 LOG.debug("Total : " + totalFields);
-            }  
-            
+            }
+
         }
     }
 
@@ -148,13 +147,13 @@
 
         int pos = 1;
         int counterMandatoryFields = 0;
- 
+
         for (String data : tokens) {
-        
+
             // Get DataField from model
             DataField dataField = dataFields.get(pos);
             ObjectHelper.notNull(dataField, "No position " + pos + " defined for the field : " + data + ", line : " + line);
-            
+
             if (dataField.required()) {
                 // Increment counter of mandatory fields
                 ++counterMandatoryFields;
@@ -162,56 +161,54 @@
                 // Check if content of the field is empty
                 // This is not possible for mandatory fields
                 if (data.equals("")) {
-                    throw new IllegalArgumentException("The mandatory field defined at the position " + pos
-                                                       + " is empty for the line : " + line);
+                    throw new IllegalArgumentException("The mandatory field defined at the position " + pos + " is empty for the line : " + line);
                 }
             }
-            
+
             // Get Field to be setted
             Field field = annotedFields.get(pos);
             field.setAccessible(true);
-            
+
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Pos : " + pos + ", Data : " + data + ", Field type : " + field.getType());
             }
-            
+
             Format<?> format;
-            
+
             // Get pattern defined for the field
             String pattern = dataField.pattern();
-            
-            // Create format object to format the field 
+
+            // Create format object to format the field
             format = FormatFactory.getFormat(field.getType(), pattern, dataField.precision());
-            
+
             // field object to be set
             Object modelField = model.get(field.getDeclaringClass().getName());
-            
+
             // format the data received
             Object value = null;
-            
+
             if (!data.equals("")) {
                 try {
                     value = format.parse(data);
                 } catch (FormatException ie) {
                     throw new IllegalArgumentException(ie.getMessage() + ", position : " + pos + ", line : " + line, ie);
                 } catch (Exception e) {
-                    throw new IllegalArgumentException("Parsing error detected for field defined at the position : " + pos  + ", line : " + line, e);
+                    throw new IllegalArgumentException("Parsing error detected for field defined at the position : " + pos + ", line : " + line, e);
                 }
             } else {
                 value = getDefaultValueforPrimitive(field.getType());
             }
-            
+
             field.set(modelField, value);
-            
-            ++pos;            
-            
+
+            ++pos;
+
         }
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug("Counter mandatory fields : " + counterMandatoryFields);
         }
-        
-     
+
         if (pos < totalFields) {
             throw new IllegalArgumentException("Some fields are missing (optional or mandatory), line : " + line);
         }
@@ -219,426 +216,341 @@
         if (counterMandatoryFields < numberMandatoryFields) {
             throw new IllegalArgumentException("Some mandatory fields are missing, line : " + line);
         }
-        
-    }
 
-    /*public String unbind(Map<String, Object> model) throws Exception {
+    }
 
-        StringBuilder builder = new StringBuilder();
+    /*
+     * public String unbind(Map<String, Object> model) throws Exception {
+     * StringBuilder builder = new StringBuilder(); Map<Integer, DataField>
+     * dataFieldsSorted = new TreeMap<Integer, DataField>(dataFields);
+     * Iterator<Integer> it = dataFieldsSorted.keySet().iterator(); // Map
+     * containing the OUT position of the field // The key is double and is
+     * created using the position of the field and // location of the class in
+     * the message (using section) Map<Integer, String> positions = new
+     * TreeMap<Integer, String>(); // Check if separator exists ObjectHelper
+     * .notNull(this.separator,
+     * "The separator has not been instantiated or property not defined in the @CsvRecord annotation"
+     * ); char separator = Converter.getCharDelimitor(this.getSeparator()); if
+     * (LOG.isDebugEnabled()) { LOG.debug("Separator converted : '0x" +
+     * Integer.toHexString(separator) + "', from : " + this.getSeparator()); }
+     * while (it.hasNext()) { DataField dataField =
+     * dataFieldsSorted.get(it.next()); // Retrieve the field Field field =
+     * annotedFields.get(dataField.pos()); // Change accessibility to allow to
+     * read protected/private fields field.setAccessible(true); // Retrieve the
+     * format, pattern and precision associated to the type Class type =
+     * field.getType(); String pattern = dataField.pattern(); int precision =
+     * dataField.precision(); // Create format Format format =
+     * FormatFactory.getFormat(type, pattern, precision); // Get field from
+     * model Object modelField = model.get(field.getDeclaringClass().getName());
+     * if (modelField != null) { // Get field value Object value =
+     * field.get(modelField); String strValue = ""; if (this.isMessageOrdered())
+     * { // Generate a key using the number of the section // and the position
+     * of the field Integer key1 =
+     * sections.get(modelField.getClass().getName()); Integer key2 =
+     * dataField.position(); Integer keyGenerated = generateKey(key1, key2); if
+     * (LOG.isDebugEnabled()) { LOG.debug("Key generated : " +
+     * String.valueOf(keyGenerated) + ", for section : " + key1); } if (value !=
+     * null) { // Format field value try { strValue = format.format(value); }
+     * catch (Exception e) { throw new
+     * IllegalArgumentException("Formating error detected for the value : " +
+     * value, e); } } // Add the content to the TreeMap according to the //
+     * position defined positions.put(keyGenerated, strValue); if
+     * (LOG.isDebugEnabled()) { LOG.debug("Positions size : " +
+     * positions.size()); } } else { // Add value to the appender if not null if
+     * (value != null) { // Format field value try { strValue =
+     * format.format(value); } catch (Exception e) { throw new
+     * IllegalArgumentException("Formating error detected for the value : " +
+     * value, e); } } if (LOG.isDebugEnabled()) {
+     * LOG.debug("Value to be formatted : " + value + ", position : " +
+     * dataField.pos() + ", and its formated value : " + strValue); }
+     * builder.append(strValue); if (it.hasNext()) { builder.append(separator);
+     * } } } } // Iterate through the list to generate // the message according
+     * to the order/position if (this.isMessageOrdered()) { Iterator<Integer>
+     * posit = positions.keySet().iterator(); while (posit.hasNext()) { String
+     * value = positions.get(posit.next()); if (LOG.isDebugEnabled()) {
+     * LOG.debug("Value added at the position (" + posit + ") : " + value +
+     * separator); } builder.append(value); if (it.hasNext()) {
+     * builder.append(separator); } } } return builder.toString(); }
+     */
 
-        Map<Integer, DataField> dataFieldsSorted = new TreeMap<Integer, DataField>(dataFields);
-        Iterator<Integer> it = dataFieldsSorted.keySet().iterator();
+    public String unbind(Map<String, Object> model) throws Exception {
 
-        // Map containing the OUT position of the field
-        // The key is double and is created using the position of the field and
-        // location of the class in the message (using section)
-        Map<Integer, String> positions = new TreeMap<Integer, String>();
+        StringBuffer buffer = new StringBuffer();
+        results = new HashMap<Integer, List>();
 
         // Check if separator exists
-        ObjectHelper
-            .notNull(this.separator,
-                     "The separator has not been instantiated or property not defined in the @CsvRecord annotation");
+        ObjectHelper.notNull(this.separator, "The separator has not been instantiated or property not defined in the @CsvRecord annotation");
 
         char separator = Converter.getCharDelimitor(this.getSeparator());
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
-                      + this.getSeparator());
+            LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : " + this.getSeparator());
         }
-        
-        while (it.hasNext()) {
 
-            DataField dataField = dataFieldsSorted.get(it.next());
+        for (Class clazz : models) {
 
-            // Retrieve the field
-            Field field = annotedFields.get(dataField.pos());
-            // Change accessibility to allow to read protected/private fields
-            field.setAccessible(true);
+            if (model.containsKey(clazz.getName())) {
 
-            // Retrieve the format, pattern and precision associated to the type
-            Class type = field.getType();
-            String pattern = dataField.pattern();
-            int precision = dataField.precision();
+                Object obj = model.get(clazz.getName());
 
-            // Create format
-            Format format = FormatFactory.getFormat(type, pattern, precision);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Model object : " + obj + ", class : " + obj.getClass().getName());
+                }
 
-            // Get field from model
-            Object modelField = model.get(field.getDeclaringClass().getName());
+                if (obj != null) {
 
-            if (modelField != null) {
+                    // Generate Csv table
+                    generateCsvPositionMap(clazz, obj);
 
-                // Get field value
-                Object value = field.get(modelField);
-                String strValue = "";
+                }
+            }
+        }
 
-                if (this.isMessageOrdered()) {
+        // Transpose result
+        List<List> l = new ArrayList<List>();
 
-                    // Generate a key using the number of the section
-                    // and the position of the field
-                    Integer key1 = sections.get(modelField.getClass().getName());
-                    Integer key2 = dataField.position();
-                    Integer keyGenerated = generateKey(key1, key2);
+        if (isOneToMany) {
 
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : "
-                                  + key1);
-                    }
+            l = product(results);
 
-                    if (value != null) {
-                        // Format field value
-                        try {
-                            strValue = format.format(value);
-                        } catch (Exception e) {
-                            throw new IllegalArgumentException("Formating error detected for the value : "
-                                                               + value, e);
-                        }
-                    }
+        } else {
 
-                    // Add the content to the TreeMap according to the
-                    // position defined
-                    positions.put(keyGenerated, strValue);
+            // Convert Map<Integer, List> into List<List>
+            TreeMap<Integer, List> sortValues = new TreeMap<Integer, List>(results);
+            List<String> temp = new ArrayList<String>();
 
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Positions size : " + positions.size());
-                    }
+            for (Integer key : sortValues.keySet()) {
+
+                // Get list of values
+                List<String> val = sortValues.get(key);
+
+                // For one to one relation
+                // There is only one item in the list
+                String value = (String)val.get(0);
 
+                // Add the value to the temp array
+                if (value != null) {
+                    temp.add(value);
                 } else {
+                    temp.add("");
+                }
+            }
+
+            l.add(temp);
+        }
 
-                    // Add value to the appender if not null
-                    if (value != null) {
+        if (l != null) {
 
-                        // Format field value
-                        try {
-                            strValue = format.format(value);
-                        } catch (Exception e) {
-                            throw new IllegalArgumentException("Formating error detected for the value : "
-                                                               + value, e);
-                        }
+            Iterator it = l.iterator();
+            while (it.hasNext()) {
 
+                List<String> tokens = (ArrayList<String>)it.next();
+                Iterator itx = tokens.iterator();
+
+                while (itx.hasNext()) {
+
+                    String res = (String)itx.next();
+
+                    if (res != null) {
+                        buffer.append(res);
+                    } else {
+                        buffer.append("");
                     }
-                    
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Value to be formatted : " + value + ", position : " + dataField.pos() + ", and its formated value : " + strValue);
+
+                    if (itx.hasNext()) {
+                        buffer.append(separator);
                     }
 
-                    builder.append(strValue);
+                }
 
-                    if (it.hasNext()) {
-                        builder.append(separator);
-                    }
+                if (it.hasNext()) {
+                    buffer.append(Converter.getStringCarriageReturn(getCarriageReturn()));
                 }
+
             }
+
         }
 
-        // Iterate through the list to generate
-        // the message according to the order/position
-        if (this.isMessageOrdered()) {
+        return buffer.toString();
 
-            Iterator<Integer> posit = positions.keySet().iterator();
+    }
 
-            while (posit.hasNext()) {
-                String value = positions.get(posit.next());
+    private List<List> product(Map<Integer, List> values) {
 
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Value added at the position (" + posit + ") : " + value + separator);
-                }
+        TreeMap<Integer, List> sortValues = new TreeMap<Integer, List>(values);
 
-                builder.append(value);
-                if (it.hasNext()) {
-                    builder.append(separator);
+        List<List> product = new ArrayList<List>();
+        Map<Integer, Integer> index = new HashMap<Integer, Integer>();
+
+        boolean cont = true;
+        int idx = 0;
+        int idxSize;
+
+        do {
+
+            idxSize = 0;
+            List v = new ArrayList();
+
+            for (int ii = 1; ii <= sortValues.lastKey(); ii++) {
+
+                List l = values.get(ii);
+
+                if (l == null) {
+                    v.add("");
+                    ++idxSize;
+                    continue;
                 }
-            }
-        }
-        
-        return builder.toString();
 
-    }*/
-    
-    public String unbind(Map<String, Object> model) throws Exception {
+                if (l.size() >= idx + 1) {
+                    v.add(l.get(idx));
+                    index.put(ii, idx);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Value : " + l.get(idx) + ", pos : " + ii + ", at :" + idx);
+                    }
 
-		StringBuffer buffer = new StringBuffer();
-		results = new HashMap<Integer, List>();
+                } else {
+                    v.add(l.get(0));
+                    index.put(ii, 0);
+                    ++idxSize;
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Value : " + l.get(0) + ", pos : " + ii + ", at index : " + 0);
+                    }
+                }
 
-		// Check if separator exists
-		ObjectHelper.notNull(this.separator,
-				"The separator has not been instantiated or property not defined in the @CsvRecord annotation");
-
-		char separator = Converter.getCharDelimitor(this.getSeparator());
-
-		if (LOG.isDebugEnabled()) {
-			LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
-							+ this.getSeparator());
-		}
-
-		for (Class clazz : models) {
-			
-			if ( model.containsKey( clazz.getName()) ) {
-
-				Object obj = model.get(clazz.getName());
-
-				if (LOG.isDebugEnabled()) {
-					LOG.debug("Model object : " + obj + ", class : " + obj.getClass().getName());
-				}
-
-				if (obj != null) {
-
-					// Generate Csv table
-					generateCsvPositionMap(clazz, obj);
-
-				}
-			}
-		}
-
-		// Transpose result
-		List<List> l = new ArrayList<List>();
-
-		if (isOneToMany) {
-			
-			l = product(results);
-			
-		} else {
-			
-			// Convert Map<Integer, List> into List<List>
-			TreeMap<Integer, List> sortValues = new TreeMap<Integer, List>(results);
-			List<String> temp = new ArrayList<String>();
-			
-			for(Integer key : sortValues.keySet()) {
-				
-				// Get list of values
-				List<String> val = sortValues.get(key);
-				
-				// For one to one relation
-				// There is only one item in the list
-				String value = (String) val.get(0);
-				
-				// Add the value to the temp array
-				if ( value != null ) {			
-				    temp.add( value );
-				} else {
-					temp.add( "" );
-				}
-			}
-			
-			l.add(temp);
-		}
-		
-
-		if (l != null) {
-
-			Iterator it = l.iterator();
-			while (it.hasNext()) {
-
-				List<String> tokens = (ArrayList<String>) it.next();
-				Iterator itx = tokens.iterator();
-
-				while (itx.hasNext()) {
-
-					String res = (String) itx.next();
-
-					if (res != null) {
-						buffer.append(res);
-					} else {
-						buffer.append("");
-					}
-
-					if (itx.hasNext()) {
-						buffer.append(separator);
-					}
-
-				}
-
-				if (it.hasNext()) {
-					buffer.append(Converter.getStringCarriageReturn(getCarriageReturn()));
-				}
+            }
 
-			}
+            if (idxSize != sortValues.lastKey()) {
+                product.add(v);
+            }
+            ++idx;
 
-		}
+        } while (idxSize != sortValues.lastKey());
 
-		return buffer.toString();
-       
+        return product;
     }
-    
-    private List<List> product(Map<Integer, List> values) {
 
-		TreeMap<Integer, List> sortValues = new TreeMap<Integer, List>(values);
+    private void generateCsvPositionMap(Class clazz, Object obj) throws Exception {
 
-		List<List> product = new ArrayList<List>();
-		Map<Integer, Integer> index = new HashMap<Integer, Integer>();
+        String result = "";
 
-		boolean cont = true;
-		int idx = 0;
-		int idxSize;
-
-		do {
-
-			idxSize = 0;
-			List v = new ArrayList();
-
-			for (int ii = 1; ii <= sortValues.lastKey(); ii++) {
-
-				List l = values.get(ii);
-
-				if (l == null) {
-					v.add("");
-					++idxSize;
-					continue;
-				}
-
-				if (l.size() >= idx + 1) {
-					v.add(l.get(idx));
-					index.put(ii, idx);
-					if (LOG.isDebugEnabled()) {
-	                    LOG.debug("Value : " + l.get(idx) + ", pos : " + ii + ", at :" + idx);
-					}
-
-				} else {
-					v.add(l.get(0));
-					index.put(ii, 0);
-					++idxSize;
-					if (LOG.isDebugEnabled()) {
-	                    LOG.debug("Value : " + l.get(0) + ", pos : " + ii + ", at index : " + 0);
-					}
-				}
-
-			}
-			
-			if ( idxSize != sortValues.lastKey()) {
-				product.add(v);
-			}
-			++idx;
-
-		} while (idxSize != sortValues.lastKey());
-
-		return product;
-	}
-	
-    
-    private void generateCsvPositionMap(Class clazz, Object obj) throws Exception {
-    	
-		String result = "";
+        for (Field field : clazz.getDeclaredFields()) {
 
-		for (Field field : clazz.getDeclaredFields()) {
+            field.setAccessible(true);
 
-			field.setAccessible(true);
+            DataField datafield = field.getAnnotation(DataField.class);
 
-			DataField datafield = field.getAnnotation(DataField.class);
+            if (datafield != null) {
 
-			if (datafield != null) {
+                if (obj != null) {
 
-				if (obj != null) {
+                    // Retrieve the format, pattern and precision associated to
+                    // the type
+                    Class type = field.getType();
+                    String pattern = datafield.pattern();
+                    int precision = datafield.precision();
 
-					// Retrieve the format, pattern and precision associated to
-					// the type
-					Class type = field.getType();
-					String pattern = datafield.pattern();
-					int precision = datafield.precision();
+                    // Create format
+                    Format format = FormatFactory.getFormat(type, pattern, precision);
 
-					// Create format
-					Format format = FormatFactory.getFormat(type, pattern, precision);
+                    // Get field value
+                    Object value = field.get(obj);
 
-					// Get field value
-					Object value = field.get(obj);
+                    result = formatString(format, value);
 
-					result = formatString(format, value);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Value to be formatted : " + value + ", position : " + datafield.pos() + ", and its formated value : " + result);
+                    }
 
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Value to be formatted : " + value + ", position : " + datafield.pos()
-								+ ", and its formated value : " + result);
-					}
+                } else {
+                    result = "";
+                }
 
-				} else {
-					result = "";
-				}
+                Integer key;
 
-				Integer key;
+                if (isMessageOrdered()) {
 
-				if (isMessageOrdered()) {
+                    // Generate a key using the number of the section
+                    // and the position of the field
+                    Integer key1 = sections.get(obj.getClass().getName());
+                    Integer key2 = datafield.position();
+                    Integer keyGenerated = generateKey(key1, key2);
+
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
+                    }
 
-					// Generate a key using the number of the section
-					// and the position of the field
-					Integer key1 = sections.get(obj.getClass().getName());
-					Integer key2 = datafield.position();
-					Integer keyGenerated = generateKey(key1, key2);
+                    key = keyGenerated;
+
+                } else {
 
-					if (LOG.isDebugEnabled()) {
-						LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
-					}
+                    key = datafield.pos();
+                }
 
-					key = keyGenerated;
+                if (!results.containsKey(key)) {
 
-				} else {
+                    List list = new LinkedList();
+                    list.add(result);
+                    results.put(key, list);
 
-					key = datafield.pos();
-				}
+                } else {
 
-				if (!results.containsKey(key)) {
+                    List list = (LinkedList)results.get(key);
+                    list.add(result);
+                }
 
-					List list = new LinkedList();
-					list.add(result);
-					results.put(key, list);
+            }
 
-				} else {
+            OneToMany oneToMany = field.getAnnotation(OneToMany.class);
+            if (oneToMany != null) {
 
-					List list = (LinkedList) results.get(key);
-					list.add(result);
-				}
+                // Set global variable
+                // Will be used during generation of CSV
+                isOneToMany = true;
 
-			}
+                ArrayList list = (ArrayList)field.get(obj);
 
-			OneToMany oneToMany = field.getAnnotation(OneToMany.class);
-			if (oneToMany != null) {
-				
-				// Set global variable
-				// Will be used during generation of CSV
-				isOneToMany = true;
+                if (list != null) {
 
-				ArrayList list = (ArrayList) field.get(obj);
+                    Iterator it = list.iterator();
 
-				if (list != null) {
+                    while (it.hasNext()) {
 
-					Iterator it = list.iterator();
+                        Object target = it.next();
+                        generateCsvPositionMap(target.getClass(), target);
 
-					while (it.hasNext()) {
+                    }
 
-						Object target = it.next();
-						generateCsvPositionMap(target.getClass(), target);
+                } else {
 
-					}
+                    // Call this function to add empty value
+                    // in the table
+                    generateCsvPositionMap(field.getClass(), null);
+                }
 
-				} else {
-					
-					// Call this function to add empty value
-					// in the table
-					generateCsvPositionMap(field.getClass(), null);
-				}
+            }
+        }
 
-			}
-		}
-    	
-    	
     }
-    
+
     private String formatString(Format format, Object value) throws Exception {
-    	
-		String strValue = "";
 
-		if (value != null) {
+        String strValue = "";
+
+        if (value != null) {
+
+            // Format field value
+            try {
+                strValue = format.format(value);
+            } catch (Exception e) {
+                throw new IllegalArgumentException("Formating error detected for the value : " + value, e);
+            }
 
-				// Format field value
-				try {
-					strValue = format.format(value);
-				} catch (Exception e) {
-					throw new IllegalArgumentException("Formating error detected for the value : " + value, e);
-				}
+        }
 
-		}
+        return strValue;
 
-		return strValue;
+    }
 
-	}
-    
     public String generateHeader() {
 
         Map<Integer, DataField> dataFieldsSorted = new TreeMap<Integer, DataField>(dataFields);
@@ -672,14 +584,12 @@
     }
 
     /**
-     * 
      * Get paramaters defined in @Csvrecord annotation
-     * 
      */
     private void initCsvRecordParameters() {
         if (separator == null) {
             for (Class<?> cl : models) {
-            
+
                 // Get annotation @CsvRecord from the class
                 CsvRecord record = cl.getAnnotation(CsvRecord.class);
 
@@ -696,16 +606,15 @@
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Skip First Line parameter of the CSV : " + skipFirstLine);
                     }
-                    
+
                     // Get generateHeaderColumnNames parameter
                     generateHeaderColumnNames = record.generateHeaderColumns();
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Generate header column names parameter of the CSV : " + generateHeaderColumnNames);
                     }
-                    
+
                     // Get Separator parameter
-                    ObjectHelper.notNull(record.separator(),
-                            "No separator has been defined in the @Record annotation !");
+                    ObjectHelper.notNull(record.separator(), "No separator has been defined in the @Record annotation !");
                     separator = record.separator();
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Separator defined for the CSV : " + separator);
@@ -716,13 +625,13 @@
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Carriage return defined for the CSV : " + crlf);
                     }
-                    
+
                     // Get isOrdered parameter
                     messageOrdered = record.isOrdered();
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Must CSV record be ordered ? " + messageOrdered);
                     }
-                    
+
                 }
 
                 if (section != null) {
@@ -735,7 +644,7 @@
             }
         }
     }
-    
+
     /**
      * Find the separator used to delimit the CSV fields
      */
@@ -749,7 +658,7 @@
     public boolean getGenerateHeaderColumnNames() {
         return generateHeaderColumnNames;
     }
-    
+
     /**
      * Find the separator used to delimit the CSV fields
      */

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFactory.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFactory.java Fri Nov 20 16:54:46 2009
@@ -41,7 +41,7 @@
      * @param model Map<String, object> is a collection of objects used to bind
      *            data. String is the the key name of the class link to POJO
      *            objects
-     * @param line is the position of the record into the file           
+     * @param line is the position of the record into the file
      * @throws Exception can be thrown
      */
     void bind(List<String> data, Map<String, Object> model, int line) throws Exception;

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java Fri Nov 20 16:54:46 2009
@@ -53,13 +53,13 @@
     private Map<Integer, KeyValuePairField> keyValuePairFields = new LinkedHashMap<Integer, KeyValuePairField>();
     private Map<Integer, Field> annotedFields = new LinkedHashMap<Integer, Field>();
     private Map<String, Integer> sections = new HashMap<String, Integer>();
-    
-	private Map<String, List> lists = new HashMap<String, List>();
+
+    private Map<String, List> lists = new HashMap<String, List>();
 
     private String keyValuePairSeparator;
     private String pairSeparator;
     private boolean messageOrdered;
-    
+
     public BindyKeyValuePairFactory(PackageScanClassResolver resolver, String... packageNames) throws Exception {
 
         super(resolver, packageNames);
@@ -86,7 +86,6 @@
 
     }
 
-   
     public void initAnnotedFields() {
 
         for (Class<?> cl : models) {
@@ -97,8 +96,7 @@
                 KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
                 if (keyValuePairField != null) {
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug("Key declared in the class : " + cl.getName() + ", key : "
-                                  + keyValuePairField.tag() + ", Field : " + keyValuePairField.toString());
+                        LOG.debug("Key declared in the class : " + cl.getName() + ", key : " + keyValuePairField.tag() + ", Field : " + keyValuePairField.toString());
                     }
                     keyValuePairFields.put(keyValuePairField.tag(), keyValuePairField);
                     annotedFields.put(keyValuePairField.tag(), field);
@@ -125,325 +123,305 @@
      * 
      */
     public void bind(List<String> data, Map<String, Object> model, int line) throws Exception {
-    	
+
         Map<Integer, List> results = new HashMap<Integer, List>();
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug("Key value pairs data : " + data);
         }
-        
+
         // Separate the key from its value
         // e.g 8=FIX 4.1 --> key = 8 and Value = FIX 4.1
-        ObjectHelper.notNull( keyValuePairSeparator, "Key Value Pair not defined in the @Message annotation");
-        
+        ObjectHelper.notNull(keyValuePairSeparator, "Key Value Pair not defined in the @Message annotation");
+
         // Generate map of key value
-        // We use a Map of List as we can have the same key several times (relation one to many)
+        // We use a Map of List as we can have the same key several times
+        // (relation one to many)
         for (String s : data) {
-        	
-        	// Get KeyValuePair
-        	String[] keyValuePair = s.split( getKeyValuePairSeparator() );
-        	
-        	// Extract Key
+
+            // Get KeyValuePair
+            String[] keyValuePair = s.split(getKeyValuePairSeparator());
+
+            // Extract Key
             int key = Integer.parseInt(keyValuePair[0]);
-            
+
             // Extract key value
             String value = keyValuePair[1];
-            
+
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Key : " + key + ", value : " + value);
             }
-            
+
             // Add value to the Map using key value as key
-			if (!results.containsKey(key)) {
-				
-				List list = new LinkedList();
-				list.add(value);
-				results.put(key, list);
-
-			} else {
-
-				List list = (LinkedList) results.get(key);
-				list.add(value);
-			}
-            
+            if (!results.containsKey(key)) {
+
+                List list = new LinkedList();
+                list.add(value);
+                results.put(key, list);
+
+            } else {
+
+                List list = (LinkedList)results.get(key);
+                list.add(value);
+            }
+
         }
-        
 
         // Iterate over the model
-		for (Class clazz : models) {
+        for (Class clazz : models) {
 
-			Object obj = model.get(clazz.getName());
+            Object obj = model.get(clazz.getName());
 
-			if (obj != null) {
+            if (obj != null) {
 
-				// Generate model from key value map
-				generateModelFromKeyValueMap(clazz, obj, results, line);
+                // Generate model from key value map
+                generateModelFromKeyValueMap(clazz, obj, results, line);
+
+            }
+        }
 
-			}
-		}
-		
     }
-    
+
     /**
-     * 
      * @param clazz
      * @param obj
      * @param results
      * @param line
      * @throws Exception
      */
-    private void generateModelFromKeyValueMap(Class clazz, Object obj, Map<Integer, List> results, int line)
-			throws Exception {
+    private void generateModelFromKeyValueMap(Class clazz, Object obj, Map<Integer, List> results, int line) throws Exception {
+
+        for (Field field : clazz.getDeclaredFields()) {
+
+            field.setAccessible(true);
+
+            KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
+
+            if (keyValuePairField != null) {
+
+                // Key
+                int key = keyValuePairField.tag();
+
+                // Get Value
+                List<String> values = results.get(key);
+                String value = null;
+
+                // we don't received data
+                if (values == null) {
+
+                    /*
+                     * The relation is one to one So we check if we are in a
+                     * target class and if the field is mandatory
+                     */
+                    if (obj != null) {
+
+                        // Check mandatory field
+                        if (keyValuePairField.required() && values == null) {
+                            throw new IllegalArgumentException("The mandatory key/tag : " + key + " has not been defined !");
+                        }
+
+                        Object result = getDefaultValueforPrimitive(field.getType());
+
+                        try {
+                            field.set(obj, result);
+                        } catch (Exception e) {
+                            throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj + " and result : " + result);
+                        }
+
+                    } else {
+
+                        /*
+                         * The relation is one to many So, we create an object
+                         * with empty fields and we don't check if the fields
+                         * are mandatory
+                         */
+
+                        // Get List from Map
+                        List l = lists.get(clazz.getName());
+
+                        if (l != null) {
+
+                            // Test if object exist
+                            if (!l.isEmpty()) {
+                                obj = l.get(0);
+                            } else {
+                                obj = clazz.newInstance();
+                            }
+
+                            Object result = getDefaultValueforPrimitive(field.getType());
+                            try {
+                                field.set(obj, result);
+                            } catch (Exception e) {
+                                throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj + " and result : " + result);
+                            }
+
+                            // Add object created to the list
+                            if (!l.isEmpty()) {
+                                l.set(0, obj);
+                            } else {
+                                l.add(0, obj);
+                            }
+
+                            // and to the Map
+                            lists.put(clazz.getName(), l);
+
+                            // Reset obj to null
+                            obj = null;
 
-		for (Field field : clazz.getDeclaredFields()) {
+                        } else {
+                            throw new IllegalArgumentException("The list of values is empty for the following key : " + key + " defined in the class : " + clazz.getName());
+                        }
+
+                    } // end of test if obj != null
+
+                } else {
+
+                    // Data have been retrieved from message
+                    if (values.size() >= 1) {
+
+                        if (obj != null) {
+
+                            // Relation OneToOne
+                            value = (String)values.get(0);
+                            Object result = null;
+
+                            if (value != null) {
+
+                                // Get pattern defined for the field
+                                String pattern = keyValuePairField.pattern();
+
+                                // Create format object to format the field
+                                Format<?> format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField.precision());
+
+                                // format the value of the key received
+                                result = formatField(format, value, key, line);
+
+                                if (LOG.isDebugEnabled()) {
+                                    LOG.debug("Value formated : " + result);
+                                }
+
+                            } else {
+                                result = getDefaultValueforPrimitive(field.getType());
+                            }
+                            try {
+                                field.set(obj, result);
+                            } catch (Exception e) {
+                                // System.out.println("Exception : " + e);
+                                throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj + " and result : " + result);
+                            }
+
+                        } else {
+
+                            // Get List from Map
+                            List l = lists.get(clazz.getName());
+
+                            if (l != null) {
+
+                                // Relation OneToMany
+                                for (int i = 0; i < values.size(); i++) {
+
+                                    // Test if object exist
+                                    if ((!l.isEmpty()) && (l.size() > i)) {
+                                        obj = l.get(i);
+                                    } else {
+                                        obj = clazz.newInstance();
+                                    }
+
+                                    value = (String)values.get(i);
+
+                                    // Get pattern defined for the field
+                                    String pattern = keyValuePairField.pattern();
+
+                                    // Create format object to format the field
+                                    Format<?> format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField.precision());
+
+                                    // format the value of the key received
+                                    Object result = formatField(format, value, key, line);
+
+                                    if (LOG.isDebugEnabled()) {
+                                        LOG.debug("Value formated : " + result);
+                                    }
+
+                                    try {
+                                        if (value != null) {
+                                            field.set(obj, result);
+                                        } else {
+                                            field.set(obj, getDefaultValueforPrimitive(field.getType()));
+                                        }
+                                    } catch (Exception e) {
+                                        throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj + " and result : " + result);
+                                    }
+
+                                    // Add object created to the list
+                                    if ((!l.isEmpty()) && (l.size() > i)) {
+                                        l.set(i, obj);
+                                    } else {
+                                        l.add(i, obj);
+                                    }
+                                    // and to the Map
+                                    lists.put(clazz.getName(), l);
+
+                                    // Reset obj to null
+                                    obj = null;
+
+                                }
+
+                            } else {
+                                throw new IllegalArgumentException("The list of values is empty for the following key : " + key + " defined in the class : " + clazz.getName());
+                            }
+                        }
+
+                    } else {
+
+                        // No values found from message
+                        Object result = getDefaultValueforPrimitive(field.getType());
+
+                        try {
+                            field.set(obj, result);
+                        } catch (Exception e) {
+                            throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj + " and result : " + result);
+                        }
+                    }
+                }
+            }
+
+            OneToMany oneToMany = field.getAnnotation(OneToMany.class);
+            if (oneToMany != null) {
+
+                String targetClass = oneToMany.mappedTo();
+
+                if (targetClass != "") {
+                    // Class cl = Class.forName(targetClass); Does not work in
+                    // OSGI when class is defined in another bundle
+                    Class cl = null;
+
+                    try {
+                        cl = Thread.currentThread().getContextClassLoader().loadClass(targetClass);
+                    }
+
+                    catch (ClassNotFoundException e) {
+                        cl = getClass().getClassLoader().loadClass(targetClass);
+                    }
 
-			field.setAccessible(true);
+                    if (!lists.containsKey(cl.getName())) {
+                        lists.put(cl.getName(), new ArrayList());
+                    }
 
-			KeyValuePairField keyValuePairField = field.getAnnotation(KeyValuePairField.class);
+                    generateModelFromKeyValueMap(cl, null, results, line);
 
-			if (keyValuePairField != null) {
-
-				// Key
-				int key = keyValuePairField.tag();
-
-				// Get Value
-				List<String> values = results.get(key);
-				String value = null;
-
-				// we don't received data
-				if (values == null) {
-
-					/*
-					 * The relation is one to one
-					 * So we check if we are in a target class
-					 * and if the field is mandatory
-					 */
-					if (obj != null) {
-
-						// Check mandatory field
-						if (keyValuePairField.required() && values == null) {
-							throw new IllegalArgumentException("The mandatory key/tag : " + key
-									+ " has not been defined !");
-						}
-						
-						Object result = getDefaultValueforPrimitive(field.getType());
-						
-						try {
-							field.set(obj, result);
-						} catch (Exception e) {
-							throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj
-									+ " and result : " + result);
-						}
-						
-					} else {
-						
-						/*
-						 * The relation is one to many
-						 * So, we create an object with empty fields
-						 * and we don't check if the fields are mandatory
-						 */
-						
-						// Get List from Map
-						List l = lists.get(clazz.getName());
-
-						if (l != null) {
-							
-							// Test if object exist
-							if (!l.isEmpty()) {
-								obj = l.get(0);
-							} else {
-								obj = clazz.newInstance();
-							}
-							
-							Object result = getDefaultValueforPrimitive(field.getType());
-							try {
-								field.set(obj, result);
-							} catch (Exception e) {
-								throw new IllegalArgumentException("Setting of field " + field + " failed for object : " + obj
-										+ " and result : " + result);
-							}							
-							
-							// Add object created to the list
-							if ( !l.isEmpty() ) {
-								l.set(0, obj);
-							} else {
-								l.add(0, obj);
-							}
-
-							// and to the Map
-							lists.put(clazz.getName(), l);
-							
-							//Reset obj to null
-							obj = null;
-							
-						} else {
-							throw new IllegalArgumentException(
-									"The list of values is empty for the following key : " + key + " defined in the class : " + clazz.getName());
-						}
-						
-						
-					} // end of test if obj != null
-
-
-
-				} else {
-
-					// Data have been retrieved from message
-					if (values.size() >= 1) {
-
-						if (obj != null) {
-
-							// Relation OneToOne
-							value = (String) values.get(0);
-							Object result = null;
-
-							if (value != null) {
-
-								// Get pattern defined for the field
-								String pattern = keyValuePairField.pattern();
-
-								// Create format object to format the field
-								Format<?> format = FormatFactory.getFormat(field.getType(), pattern, keyValuePairField
-										.precision());
-
-								// format the value of the key received
-								result = formatField(format, value, key, line);
-
-								if (LOG.isDebugEnabled()) {
-									LOG.debug("Value formated : " + result);
-								}
-
-							} else {
-								result = getDefaultValueforPrimitive(field.getType());
-							}
-							try {
-								field.set(obj, result);
-							} catch (Exception e) {
-								// System.out.println("Exception : " + e);
-								throw new IllegalArgumentException("Setting of field " + field
-										+ " failed for object : " + obj + " and result : " + result);
-							}
-
-						} else {
-
-							// Get List from Map
-							List l = lists.get(clazz.getName());
-
-							if (l != null) {
-
-								// Relation OneToMany
-								for (int i = 0; i < values.size(); i++) {
-
-									// Test if object exist
-									if ((!l.isEmpty()) && (l.size() > i)) {
-										obj = l.get(i);
-									} else {
-										obj = clazz.newInstance();
-									}
-
-									value = (String) values.get(i);
-
-									// Get pattern defined for the field
-									String pattern = keyValuePairField.pattern();
-
-									// Create format object to format the field
-									Format<?> format = FormatFactory.getFormat(field.getType(), pattern,
-											keyValuePairField.precision());
-
-									// format the value of the key received
-									Object result = formatField(format, value, key, line);
-
-									if (LOG.isDebugEnabled()) {
-										LOG.debug("Value formated : " + result);
-									}
-
-									try {
-										if (value != null) {
-											field.set(obj, result);
-										} else {
-											field.set(obj, getDefaultValueforPrimitive(field.getType()));
-										}
-									} catch (Exception e) {
-										throw new IllegalArgumentException("Setting of field " + field
-												+ " failed for object : " + obj + " and result : " + result);
-									}
-
-									// Add object created to the list
-									if ((!l.isEmpty()) && (l.size() > i)) {
-										l.set(i, obj);
-									} else {
-										l.add(i, obj);
-									}
-									// and to the Map
-									lists.put(clazz.getName(), l);
-									
-									//Reset obj to null
-									obj = null;
-
-								}
-
-							} else {
-								throw new IllegalArgumentException(
-										"The list of values is empty for the following key : " + key
-												+ " defined in the class : " + clazz.getName());
-							}
-						}
-
-					} else {
-
-						// No values found from message
-						Object result = getDefaultValueforPrimitive(field.getType());
-
-						try {
-							field.set(obj, result);
-						} catch (Exception e) {
-							throw new IllegalArgumentException("Setting of field " + field + " failed for object : "
-									+ obj + " and result : " + result);
-						}
-					}
-				}
-			}
-
-			OneToMany oneToMany = field.getAnnotation(OneToMany.class);
-			if (oneToMany != null) {
-
-				String targetClass = oneToMany.mappedTo();
-
-				if (targetClass != "") {
-					// Class cl = Class.forName(targetClass); Does not work in OSGI when class is defined in another bundle
-				    Class cl = null;
-
-				    try {
-
-				        cl = Thread.currentThread().getContextClassLoader().loadClass( targetClass );
-
-				    }
-
-				    catch (ClassNotFoundException e) {
-
-				        cl = getClass().getClassLoader().loadClass( targetClass );
-
-				    }
-
-					if (!lists.containsKey(cl.getName())) {
-						lists.put(cl.getName(), new ArrayList());
-					}
-
-					generateModelFromKeyValueMap(cl, null, results, line);
-
-					// Add list of objects
-					field.set(obj, lists.get(cl.getName()));
-
-				} else {
-					throw new IllegalArgumentException("No target class has been defined in @OneToMany annotation !");
-				}
+                    // Add list of objects
+                    field.set(obj, lists.get(cl.getName()));
 
-			}
+                } else {
+                    throw new IllegalArgumentException("No target class has been defined in @OneToMany annotation !");
+                }
 
-		}
+            }
+
+        }
+
+    }
 
-	}
-    
     /**
      * 
      */
@@ -460,15 +438,12 @@
         Map<Integer, String> positions = new TreeMap<Integer, String>();
 
         // Check if separator exists
-        ObjectHelper
-            .notNull(this.pairSeparator,
-                     "The pair separator has not been instantiated or property not defined in the @Message annotation");
+        ObjectHelper.notNull(this.pairSeparator, "The pair separator has not been instantiated or property not defined in the @Message annotation");
 
         char separator = Converter.getCharDelimitor(this.getPairSeparator());
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : "
-                      + this.getPairSeparator());
+            LOG.debug("Separator converted : '0x" + Integer.toHexString(separator) + "', from : " + this.getPairSeparator());
         }
 
         while (it.hasNext()) {
@@ -482,8 +457,7 @@
             field.setAccessible(true);
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Tag : " + keyValuePairField.tag() + ", Field type : " + field.getType()
-                          + ", class : " + field.getDeclaringClass().getName());
+                LOG.debug("Tag : " + keyValuePairField.tag() + ", Field type : " + field.getType() + ", class : " + field.getDeclaringClass().getName());
             }
 
             // Retrieve the format, pattern and precision associated to the type
@@ -510,8 +484,7 @@
                     Integer keyGenerated = generateKey(key1, key2);
 
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : "
-                                  + key1);
+                        LOG.debug("Key generated : " + String.valueOf(keyGenerated) + ", for section : " + key1);
                     }
 
                     // Add value to the list if not null
@@ -523,14 +496,12 @@
                         try {
                             valueFormated = format.format(keyValue);
                         } catch (Exception e) {
-                            throw new IllegalArgumentException("Formating error detected for the tag : "
-                                                               + keyValuePairField.tag(), e);
+                            throw new IllegalArgumentException("Formating error detected for the tag : " + keyValuePairField.tag(), e);
                         }
 
                         // Create the key value string
-                        String value = keyValuePairField.tag() + this.getKeyValuePairSeparator()
-                                       + valueFormated;
-                                       
+                        String value = keyValuePairField.tag() + this.getKeyValuePairSeparator() + valueFormated;
+
                         if (LOG.isDebugEnabled()) {
                             LOG.debug("Value to be formatted : " + keyValue + ", for the tag : " + keyValuePairField.tag() + ", and its formated value : " + valueFormated);
                         }
@@ -554,20 +525,17 @@
                         try {
                             valueFormated = format.format(keyValue);
                         } catch (Exception e) {
-                            throw new IllegalArgumentException("Formating error detected for the tag : "
-                                                               + keyValuePairField.tag(), e);
+                            throw new IllegalArgumentException("Formating error detected for the tag : " + keyValuePairField.tag(), e);
                         }
 
                         // Create the key value string
-                        String value = keyValuePairField.tag() + this.getKeyValuePairSeparator()
-                                       + valueFormated + separator;
+                        String value = keyValuePairField.tag() + this.getKeyValuePairSeparator() + valueFormated + separator;
 
                         // Add content to the stringBuilder
                         builder.append(value);
 
                         if (LOG.isDebugEnabled()) {
-                            LOG.debug("Value added : " + keyValuePairField.tag()
-                                      + this.getKeyValuePairSeparator() + valueFormated + separator);
+                            LOG.debug("Value added : " + keyValuePairField.tag() + this.getKeyValuePairSeparator() + valueFormated + separator);
                         }
                     }
                 }
@@ -593,26 +561,25 @@
 
         return builder.toString();
     }
-    
+
     private Object formatField(Format format, String value, int tag, int line) throws Exception {
-    	
-		Object obj = null ;
 
-		if (value != null) {
+        Object obj = null;
 
-				// Format field value
-				try {
-					obj = format.parse( value );	
-				} catch (Exception e) {
-					throw new IllegalArgumentException("Parsing error detected for field defined at the tag : " + tag
-	                        + ", line : " + line, e);
-				}
+        if (value != null) {
 
-		}
+            // Format field value
+            try {
+                obj = format.parse(value);
+            } catch (Exception e) {
+                throw new IllegalArgumentException("Parsing error detected for field defined at the tag : " + tag + ", line : " + line, e);
+            }
+
+        }
 
-		return obj;
+        return obj;
 
-	}
+    }
 
     /**
      * Find the pair separator used to delimit the key value pair fields
@@ -627,7 +594,7 @@
     public String getKeyValuePairSeparator() {
         return keyValuePairSeparator;
     }
-    
+
     /**
      * Flag indicating if the message must be ordered
      * 
@@ -645,22 +612,20 @@
             for (Class<?> cl : models) {
                 // Get annotation @Message from the class
                 Message message = cl.getAnnotation(Message.class);
-                
+
                 // Get annotation @Section from the class
                 Section section = cl.getAnnotation(Section.class);
 
                 if (message != null) {
                     // Get Pair Separator parameter
-                    ObjectHelper.notNull(message.pairSeparator(),
-                            "No Pair Separator has been defined in the @Message annotation !");
+                    ObjectHelper.notNull(message.pairSeparator(), "No Pair Separator has been defined in the @Message annotation !");
                     pairSeparator = message.pairSeparator();
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Pair Separator defined for the message : " + pairSeparator);
                     }
 
                     // Get KeyValuePair Separator parameter
-                    ObjectHelper.notNull(message.keyValuePairSeparator(),
-                            "No Key Value Pair Separator has been defined in the @Message annotation !");
+                    ObjectHelper.notNull(message.keyValuePairSeparator(), "No Key Value Pair Separator has been defined in the @Message annotation !");
                     keyValuePairSeparator = message.keyValuePairSeparator();
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Key Value Pair Separator defined for the message : " + keyValuePairSeparator);
@@ -678,11 +643,11 @@
                         LOG.debug("Is the message ordered in output : " + messageOrdered);
                     }
                 }
-                
+
                 if (section != null) {
                     // Test 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
                     sections.put(cl.getName(), section.number());
                 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/Format.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/Format.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/Format.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/Format.java Fri Nov 20 16:54:46 2009
@@ -17,7 +17,8 @@
 package org.apache.camel.dataformat.bindy;
 
 /**
- * Format allows to format object to and from string received using format or parse method
+ * Format allows to format object to and from string received using format or
+ * parse method
  */
 public interface Format<T> {
 

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/FormatFactory.java Fri Nov 20 16:54:46 2009
@@ -58,37 +58,37 @@
     public static Format<?> getFormat(Class<?> clazz, String pattern, int precision) throws Exception {
         if (clazz == byte.class || clazz == Byte.class) {
             return pattern != null ? new BytePatternFormat(pattern) : new ByteFormat();
-            
+
         } else if (clazz == short.class || clazz == Short.class) {
             return pattern != null ? new ShortPatternFormat(pattern) : new ShortFormat();
-            
+
         } else if (clazz == int.class || clazz == Integer.class) {
             return pattern != null ? new IntegerPatternFormat(pattern) : new IntegerFormat();
-            
+
         } else if (clazz == long.class || clazz == Long.class) {
             return pattern != null ? new LongPatternFormat(pattern) : new LongFormat();
-            
+
         } else if (clazz == float.class || clazz == Float.class) {
             return pattern != null ? new FloatPatternFormat(pattern) : new FloatFormat();
-            
+
         } else if (clazz == double.class || clazz == Double.class) {
             return pattern != null ? new DoublePatternFormat(pattern) : new DoubleFormat();
-            
+
         } else if (clazz == BigDecimal.class) {
             return new BigDecimalFormat(precision);
-            
+
         } 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);
-            
+
         } else if (clazz == char.class || clazz == Character.class) {
             return new CharacterFormat();
-            
+
         } else {
             throw new IllegalArgumentException("Can not find a suitable formatter for the type: " + clazz.getCanonicalName());
         }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/PatternFormat.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/PatternFormat.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/PatternFormat.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/PatternFormat.java Fri Nov 20 16:54:46 2009
@@ -25,7 +25,7 @@
     /**
      * Method used to retrieve the pattern for the format
      * 
-     * @return String  the pattern
+     * @return String the pattern
      */
     String getPattern();
 

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java Fri Nov 20 16:54:46 2009
@@ -24,13 +24,14 @@
  * This annotation represents the root class of the model. When a CSV,
  * fixed-length record must be described in the model we will use this
  * annotation and the separator (for csv record) to know how to split the data
- * during the unmarshal process
- * The separator (mandatory)
- * The name is optional and could be used in the future to bind a property which a different name
- * The skipfirstline (optional) allows to skip the first line of the file/content received
- * The generateHeaderColumnNames (optional) allow to add in the CSV generated the header containing names of the columns
- * The crlf (optional) is used to add a new line after a record. By default, the value is WINDOWS 
- * The isOrdered (optional) boolean is used to ordered the message generated in output
+ * during the unmarshal process The separator (mandatory) The name is optional
+ * and could be used in the future to bind a property which a different name The
+ * skipfirstline (optional) allows to skip the first line of the file/content
+ * received The generateHeaderColumnNames (optional) allow to add in the CSV
+ * generated the header containing names of the columns The crlf (optional) is
+ * used to add a new line after a record. By default, the value is WINDOWS The
+ * isOrdered (optional) boolean is used to ordered the message generated in
+ * output
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
@@ -57,31 +58,28 @@
      * @return boolean
      */
     boolean skipFirstLine() default false;
-    
+
     /**
-     * Character to be used to add a carriage return after each record (optional)
-     * Three values can be used : WINDOWS, UNIX or MAC
+     * Character to be used to add a carriage return after each record
+     * (optional) Three values can be used : WINDOWS, UNIX or MAC
      * 
      * @return String
      */
     String crlf() default "WINDOWS";
-    
+
     /**
-     * 
-     * The generateHeaderColumns parameter allow to add in the CSV generated
-     * the header containing names of the columns
+     * The generateHeaderColumns parameter allow to add in the CSV generated the
+     * header containing names of the columns
      * 
      * @return boolean
      */
     boolean generateHeaderColumns() default false;
-    
+
     /**
-     * 
      * Indicates if the message must be ordered in output
      * 
      * @return boolean
      */
     boolean isOrdered() default false;
-    
 
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java Fri Nov 20 16:54:46 2009
@@ -22,15 +22,16 @@
 
 /**
  * An annotation used to identify in a POJO which property is link to a field of
- * a record (csv, ...).
- * The pos (mandatory) identifies the position of the data in the record
- * The name is optional and could be used in the future to bind a property which a different name
- * The columnName (optional) represents the name of the column who will appear in the header
- * The pattern (optional) allows to define the pattern of the data (useful for Date, ...)
- * The length (optional) allows to define for fixed length message the size of the data's block
- * The precision(optional) reflects the precision to be used with BigDecimal number
- * The position (optional) identify the position of the field in the CSV generated
- * The required (optional) property identifies a field which is mandatory.
+ * a record (csv, ...). The pos (mandatory) identifies the position of the data
+ * in the record The name is optional and could be used in the future to bind a
+ * property which a different name The columnName (optional) represents the name
+ * of the column who will appear in the header The pattern (optional) allows to
+ * define the pattern of the data (useful for Date, ...) The length (optional)
+ * allows to define for fixed length message the size of the data's block The
+ * precision(optional) reflects the precision to be used with BigDecimal number
+ * The position (optional) identify the position of the field in the CSV
+ * generated The required (optional) property identifies a field which is
+ * mandatory.
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
@@ -49,10 +50,10 @@
      * @return String
      */
     String name() default "";
-    
+
     /**
      * name of the header column (optional)
-     *  
+     * 
      * @return String
      */
     String columnName() default "";
@@ -78,17 +79,15 @@
      * @return int
      */
     int precision() default 0;
-    
+
     /**
-     * 
      * Position of the field in the message generated
      * 
-     * @return int 
+     * @return int
      */
     int position() default 0;
-    
+
     /**
-     * 
      * Indicates if the field is mandatory
      * 
      * @return boolean

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/KeyValuePairField.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/KeyValuePairField.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/KeyValuePairField.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/KeyValuePairField.java Fri Nov 20 16:54:46 2009
@@ -21,14 +21,16 @@
 import java.lang.annotation.RetentionPolicy;
 
 /**
- * An annotation used to identify in a POJO which property is link to a key value pair field
- * The tag (mandatory) identifies the key of the key value pair (e.g. 8 equals the begin string in FIX
- * The name (optional) could be used in the future to bind a property which a different name
- * The pattern (optional) allows to define the pattern of the data (useful for Date, BigDecimal ...)
- * The precision (optional) reflects the precision to be used with BigDecimal number
- * The required (optional) field allows to define if the field is required or not. This property is
- * not yet used but will be useful in the future with the validation
- * The position (optional) field is used to order the tags during the creation of the message
+ * An annotation used to identify in a POJO which property is link to a key
+ * value pair field The tag (mandatory) identifies the key of the key value pair
+ * (e.g. 8 equals the begin string in FIX The name (optional) could be used in
+ * the future to bind a property which a different name The pattern (optional)
+ * allows to define the pattern of the data (useful for Date, BigDecimal ...)
+ * The precision (optional) reflects the precision to be used with BigDecimal
+ * number The required (optional) field allows to define if the field is
+ * required or not. This property is not yet used but will be useful in the
+ * future with the validation The position (optional) field is used to order the
+ * tags during the creation of the message
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
@@ -54,12 +56,11 @@
      * @return String
      */
     String pattern() default "";
-    
+
     /**
-     * 
      * Position of the field in the message generated
      * 
-     * @return int 
+     * @return int
      */
     int position() default 0;
 
@@ -69,7 +70,7 @@
      * @return int
      */
     int precision() default 0;
-    
+
     boolean required() default false;
 
 }

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/Message.java Fri Nov 20 16:54:46 2009
@@ -23,17 +23,15 @@
 /**
  * This annotation represents the root class of the model. When a message (FIX
  * message containing key-value pairs) must be described in the model, we will
- * use this annotation.
- * 
- * The key pair separator (mandatory) defines the separator between the key and
- * the value The pair separator (mandatory) allows to define which character
- * separate the pairs from each other The name is optional and could be used in
- * the future to bind a property which a different name The type (optional)
- * allow to define the type of the message (e.g. FIX, EMX, ...) The version
- * (optional) defines the version of the message (e.g. 4.1, ...) The crlf
- * (optional) is used to add a new line after a record. By default, the value is
- * WINDOWS The isOrdered (optional) boolean is used to ordered the message
- * generated in output (line feed and carriage return on windows
+ * use this annotation. The key pair separator (mandatory) defines the separator
+ * between the key and the value The pair separator (mandatory) allows to define
+ * which character separate the pairs from each other The name is optional and
+ * could be used in the future to bind a property which a different name The
+ * type (optional) allow to define the type of the message (e.g. FIX, EMX, ...)
+ * The version (optional) defines the version of the message (e.g. 4.1, ...) The
+ * crlf (optional) is used to add a new line after a record. By default, the
+ * value is WINDOWS The isOrdered (optional) boolean is used to ordered the
+ * message generated in output (line feed and carriage return on windows
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
@@ -81,7 +79,6 @@
     String crlf() default "WINDOWS";
 
     /**
-     * 
      * Indicates if the message must be ordered in output
      * 
      * @return boolean

Modified: camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/OneToMany.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/OneToMany.java?rev=882639&r1=882638&r2=882639&view=diff
==============================================================================
--- camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/OneToMany.java (original)
+++ camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/OneToMany.java Fri Nov 20 16:54:46 2009
@@ -23,7 +23,6 @@
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
 public @interface OneToMany {
-	
-	String mappedTo() default "";
 
+    String mappedTo() default "";
 }



Mime
View raw message