Created
December 6, 2013 12:20
-
-
Save splatch/7822875 to your computer and use it in GitHub Desktop.
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
| public class JacksonDataFormatSplitExpression extends ExpressionAdapter | |
| { | |
| private final JacksonDataFormat format; | |
| private final FormatSchema schema; | |
| public JacksonDataFormatSplitExpression(JacksonDataFormat format, FormatSchema schema) | |
| { | |
| this.format = format; | |
| this.schema = schema; | |
| } | |
| @Override | |
| public Object evaluate(Exchange exchange) | |
| { | |
| try | |
| { | |
| return format.getObjectMapper() | |
| .reader(schema) | |
| .withType(format.getUnmarshalType()) | |
| .withView(format.getJsonView()) | |
| .readValues(exchange.getIn().getBody(Reader.class)); | |
| } | |
| catch (IOException e) | |
| { | |
| throw new RuntimeCamelException("Unable to read data with Jackson object mapper", e); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment