Somehow I should be able to specify a chain like this while value is piped through each function.
a::create -> a::processing -> a::updating -> a:uploading
In context of following articles I want to chain the methods with one method passing the result to the next while modifying it.
https://dzone.com/articles/higher-order-functions
https://dzone.com/articles/functional-programming-java-8
my demo will try to show what I want as the end result. It's going to be a single parameter/argument piped to each method (like monads) and should be easier to specify an arbitrary number of methods in a chain.
I've been doing this in other languages so trying to get my head around in how to do in java.
All methods will receive same type of argument and only one.
Class Value
public class Value {
public String progress = "";
}
Class Article
public class Article {
public void create(Value value) {
value.progress += "creating ";
}
public void processing(Value value) {
value.progress += "processing ";
}
public void updating(Value value) {
value.progress += "updating ";
}
public void uploading(Value value) {
value.progress += "uploading ";
}
}
Main Class
public class Main {
public static void main(String[] args) {
Value v = new Value();
Article a = new Article();
a.create(v);
a.processing(v);
a.updating(v);
a.uploading(v);
}
}