camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lost_in <>
Subject when two Pojo class annotated with @CsvRecord in same package, camel goes wrong
Date Tue, 23 Apr 2013 15:33:14 GMT
i follow  <<camel in action>>'s chapter3/order demo, i confused with
following situation:

1) i  create simple Pojo class in same package with

//content as follows:

@CsvRecord(separator = ",", crlf = "UNIX")
public class Person {
	@DataField(pos = 1)  //because this field's pos ==1, it make ==null 
	private String name2;

	public String getName2() {
		return name2;

	public void setName(String name2) {
		this.name2 = name2;

	public String toString() {
		return String.format("%s", name2);


2)this is my RouteBuilder defination:

public class MainEntry extends CamelTestSupport {

	public static class MyBean {
		public void convert(Exchange exchange) {
			Object object = exchange.getIn().getBody();
			//at this point,Object isInstanceOf PurchaseOrder but ==null  

	@EndpointInject(uri = "mock:end")
	protected MockEndpoint toEndpoint;

	@Produce(uri = "direct:start")
	protected ProducerTemplate template;

	public void test_marshal() throws Exception {
		// must set expect before call template.sendBody()
		template.sendBody("Camel in Action,39.95,1");

	protected RouteBuilder createRouteBuilder() throws Exception {
		// return super.createRouteBuilder();
		return new RouteBuilder() {

			public void configure() throws Exception {
				.bindy(BindyType.Csv, PurchaseOrder.class)  //use class instead of
package name
				.bean(new MyBean())

my question is in MyBean.convert method, ==null ?????
3)attachment is my test project.

is it a bug or there is some thing wrong with my code?
how to workaround it?
any answer is appreciate

View this message in context:
Sent from the Camel Development mailing list archive at

View raw message