Category Archives: bindy

Camel Bindy Fixed Length Format : How to use inherited classes?

I have two classes CommonRequest and AccountRequest

@FixedLengthRecord(paddingChar=' ',ignoreTrailingChars=true)
public class CommonRequest {

@Id
private String corelationID;

@DataField(pos=1,length=8)
private String cmNumber;

@DataField(pos=2,length=16)
private String accountNumber;

}

And AccountRequest.java

@FixedLengthRecord(paddingChar=' ',ignoreTrailingChars=true)
public class AccountRequest extends CommonRequest {

@Id
private String corelationID;

@DataField(pos=3,length=14)
private String accountType;

@DataField(pos=4,length=15)
private String accountLocation;

}

When I tries to unmarshall a record like cmNumberaccountNumberaccountTypeaccountLocation

It unmarshall common request properly but when i tries to unmarshall AccountRequest it takes the position from start instead of continuing it from the position left in common request.

And this mismatches whole fields in the AccountRequest.