2

I have this problem about receiving a Input object this object behavior like a List.

I want to process this object through a FilterObject and generate ProcessedFilterObject after that I will send the same object to a kind of EnricherObject that will return some kind of ProcessedEnrichedObject with possible errors and so on.

This problem is very similar to some Enterprise Integration Patterns I know but right now I can't remember if there's a elegant OO pattern which would solve the problem. Does anyone know a elegant and extensible solution? (I want to be able to add other transformers, filter or enrichers later).

  • What have you tried so far? And have you looked at using the java8 streams api? – beresfordt Feb 21 '15 at 21:49
  • Consider using the [decorator pattern](http://stackoverflow.com/questions/2707401/please-help-me-understand-the-decorator-pattern-with-a-real-world-example) and/or the [chain of responsibility pattern](http://stackoverflow.com/a/13644074/1594449). – gknicker Feb 21 '15 at 21:53
  • Apache Camel is a library that implements EIPs, letting you only write the parts that matter for your use case. – Chris Pitman Feb 22 '15 at 03:34

1 Answers1

2

You could model this using chain of responsibility pattern. Refer wiki to understand more.

cassiomolin
  • 124,154
  • 35
  • 280
  • 359
Sivaramvt
  • 83
  • 1
  • 4
  • Yes, that's my first solution. I was trying to figure out if there was a different approach. It seems I am in the right way. Thanks guys~! – hugodesmarques Feb 22 '15 at 23:20