Last active
July 4, 2019 22:14
-
-
Save gurpal2000/6eb9c4e20180a4668b4fe261b8e449bb to your computer and use it in GitHub Desktop.
camel-issue-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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