Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 44767 invoked from network); 26 Mar 2008 09:13:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2008 09:13:24 -0000 Received: (qmail 66890 invoked by uid 500); 26 Mar 2008 09:13:22 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 66875 invoked by uid 500); 26 Mar 2008 09:13:22 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 66861 invoked by uid 99); 26 Mar 2008 09:13:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2008 02:13:22 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2008 09:12:41 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JeRgi-0003Es-Sk for camel-user@activemq.apache.org; Wed, 26 Mar 2008 02:12:52 -0700 Message-ID: <16297915.post@talk.nabble.com> Date: Wed, 26 Mar 2008 02:12:52 -0700 (PDT) From: cmoulliard To: camel-user@activemq.apache.org Subject: Re: Map content of CSV file to POJO using @Annotation !! In-Reply-To: <47EA088E.7080305@skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: cmoulliard@gmail.com References: <16296721.post@talk.nabble.com> <47EA088E.7080305@skynet.be> X-Virus-Checked: Checked by ClamAV on apache.org For sure, I can create a task in JIRA. I will sign-up in JIRA for that. Gert Vanthienen wrote: > > Charles, > > I don't think this feature is currently supported by Camel, but it would > sure make a nice addition. Could you open a JIRA for it? > > Gert > > cmoulliard wrote: >> Hi, >> >> I would like to know if someone has an example showing how to map the >> content of a CSV file to a POJO using inside this POJO class @annotation >> ? >> For the moment, I use ArrayList + iterator (see code hereafter) to >> achieve >> the extraction of the content but I'm sure that I can simplify my code >> using >> @Annotation >> >> E.g. : >> >> Camel route >> >> from("file:///c:/temp/test?noop=true") >> .unmarshal().csv() >> .to("bean:converter?methodName=TransformMessage"); >> >> Converter class >> >> public void TransformMessage(Exchange in) { >> process(in.getIn().getBody(List.class)); >> } >> >> @SuppressWarnings("unchecked") >> private void process(List messages) { >> >> // Iterate through the list of messages >> for (Iterator it = messages.iterator(); it.hasNext();) { >> >> // Split the content of the message into field >> message = it.next(); >> field = (String[]) message.toArray(); >> >> order = new Order(); >> order.setId(Integer.valueOf(field[0]).intValue()); >> order.setBank(field[1]); >> order.setAmountFrom(Double.parseDouble(field[2])); >> order.setAmountTo(Double.parseDouble(field[3])); >> order.setOrderInstruction(field[4].trim()); >> this.orderService.createOrder(order); >> >> } >> } >> >> Regards, >> >> Charles >> > > > > ----- > --- > Gert Vanthienen > http://www.anova.be > -- View this message in context: http://www.nabble.com/Map-content-of-CSV-file-to-POJO-using-%40Annotation-%21%21-tp16296721s22882p16297915.html Sent from the Camel - Users mailing list archive at Nabble.com.