Skip to content

Instantly share code, notes, and snippets.

@gurpal2000
Last active July 4, 2019 22:14
Show Gist options
  • Save gurpal2000/6eb9c4e20180a4668b4fe261b8e449bb to your computer and use it in GitHub Desktop.
Save gurpal2000/6eb9c4e20180a4668b4fe261b8e449bb to your computer and use it in GitHub Desktop.
camel-issue-1
// instrument populated from a CSV
@Data
public class Instrument {
private LocalDate expiry;
}
// map transformer
public class MapTransformer {
public Map<String, Object> getMap(Object obj) {
return (new ObjectMapper()).convertValue(obj, new TypeReference<Map<String, Object>>() {});
}
}
// route
from(...) {
...
.unmarshal(new BindyCsvDataFormat(Instrument.class))
.bean(MapTransformer.class, "getMap")
// at this point the LocalDate is a LinkedHashMap according to debug
.to("sql:" + generateInsertStatement(Instrument.class) + "?dataSource=#dataSource")
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment