My question is regarding design
I'm trying to design my pipeline based of different methods.
Suppose my Class :
public class Pipeline {
public Object method1AAA(String a){
// impl1..
}
public Object method2BBB(List<Object> list){
// impl2..
}
public Object method3CCC(Map<String,String> map, Object otherStuff){
// impl3..
}
// other different methods ....
}
I want to follow this concept http://qrman.github.io/posts/2017/02/09/pipeline-pattern-plumber-quest
But my difference is that I use the only 1 class with multiple methods, if i had different services I would create new class to each service with interface implementation as in the link , but my purpose is create list of order methods inside 1 class that will iterate and execute them...
I was thinking about some method reference based on java 8
like described here : https://www.codementor.io/eh3rrera/using-java-8-method-reference-du10866vx
basic idea ?
List<> list = new ArrayList<>();
list.add(::method1)
list.add(::method2)
list.add(::method3) ...
forEach ..list -> execute
Thanks a lot
Aucun commentaire:
Enregistrer un commentaire