java - File processing design suggesstion -
java - File processing design suggesstion -
i developing application process multiple csv files using apache camel. processing involves multiple transformation , validations.
the format of files can dynamic csv header before arrives. don't want add together new model every time new format arrives, instead want create map key value pairs. simple validations , complex rules, had convert bean (since using drools , bean validation).
if create lots of models incoming files, camel processor has have lots of conditional statements choosing right strategy process. instanceof (bad idea) or type based strategy selection.
can suggest me design approach tackle this.
use camel csv component list maps holding key value pairs:
final csvdataformat format = new csvdataformat(); format.setusemaps(true); format.setdelimiter(","); from("direct:start") .unmarshal(format) .process(new processor() { @override public void process(final exchange exchange) throws exception { final list<map<string, string>> body = exchange.getin().getbody(list.class); // transform and/or validate data... });
the processor transform info java beans or straight validate content.
java csv design apache-camel
Comments
Post a Comment