[ 
https://issues.apache.org/jira/browse/CAMEL-7489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14537500#comment-14537500
 ] 

Andrew Block commented on CAMEL-7489:
-------------------------------------

Looked into this issue and confirmed the issue. The following could be made in 
BindyCsvFactory to allow for positioning in csv marshaling 

{code}
                if (isMessageOrdered() && obj != null) {

                    if(sections.size() > 0) {
                        // 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: {}, for section: {}", 
String.valueOf(keyGenerated), key1);
                        }
    
                        key = keyGenerated;
                    }
                    else {
                        key = datafield.position();
                    }

                } else {
                    key = datafield.pos();
                }
{code}

For the KeyValuePair, there are unit tests expecting the existing 
functionality. What is the ultimate desired functionality for each marshaling 
options?

> Bindy CSV DataField position requires @Section or  @KeyValuePairDataField
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-7489
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7489
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-bindy
>            Reporter: Marco Carvalho
>            Priority: Minor
>
> When using DataField as in "case 8" of the documentation page (sorry, no 
> anchor links):
> http://camel.apache.org/bindy.html
> A exception is risen for a missing Section annotation.
> "@Section and/or @KeyValuePairDataField have not been defined"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to