Beyond the usual conventions, there are two things I dislike about returning Task from the
setters:
1. the "set" prefix prevents a true "fluent" method chain. Compare the
method chains with and without the TaskBuilder.
2. what if I want to add comments, subtasks, etc? the task interface does not have methods
for that, you have to go back to the task service. The task builder can
"remember" the task service that created it and invoke it internally.
task = taskService.buildTask()
| .name("report expenses")
| .due(today)
| .subTask()
| .name("gather receipts")
| .due(beforeLunch)
| .subTask()
| .name("capture amounts")
| .due(beforeLeaving)
| .done();
anonymous wrote : TaskBuilder is definitely not good. Task with setter is the way to go.
I got the TaskBuilder idea from the ProcessFactory that is already in the PVM module. How
are they different?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196329#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...