Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I'm not quite sure I understand your problem, but it sounds like you need to be able to add both additional processing types and data types to the same data structure. This is commonly known as the expression problem and the usual approach in an OO language is to use the visitor pattern, although there are other more exotic solutions like object algebras. Commented May 2, 2016 at 7:44
  • @Jules I am trying to implement a simple pipeline (business logic) comprising of multiple steps. What I am looking for is to make each step reusable. This way each step can be plugged in & out in different pipelines. The constraint here is that different Pipelines might be working on different POJOs so the Stage(or step) should be able to handle that. One solution is to have multiple concrete Stages doing same thing but on different POJOs. The processing can be provided by Abstract Stage & POJO handling by Concrete Stages. Commented May 2, 2016 at 8:07
  • @Jules I have updated the Question with Problem Example. Commented May 2, 2016 at 9:08
  • 2
    Why not just have USBooks and IndianBooks that inherit from the same Books class which has publisher/price/edition. Commented May 2, 2016 at 14:19
  • Another option is to implement Step<IndianBooks> to force the type used with this specific step during compilation Commented May 2, 2016 at 14:26