Menu

#3 Consider changing how we construct classes with optionl args

open
None
2
2004-05-04
2004-05-04
No

As proposed by Joăo Cachopo this bit of code found in file layers/frontend/pt/inesc_id/esw/worksco/frontend/FrontEndWorkflowDefinition.jak:

public WorkflowDefinition compile() {
return new WorkflowDefinition(_id, _name)
.setExecutionGraph(_rootActivity.compile())
.setDataTypes(_dataTypes)
.setFrontEndWorkflowDefinition(this);
}

could be changed to something like

public WorkflowDefinition compile() {
return new WorkflowDefinition(new WorkflowDefinitionArgs() {{
id = _id;
names = names;
executionGraph = _rootActivity.compile();
dataTypes = _dataTypes;
frontEndWorkflowDefinition = FrontEndWorkflowDefinition.this; // bug if I use only 'this'
}});
}
}

And WorkflowDefinitionArgs is something like:

public static class WorkflowDefinitionArgs {
String id; // required arg
List dataTypes = new ArrayList(); // optional arg
}

Even better, if WorkflowDefinitionArgs could be an inner class of WorkflowDefinition, but then AHEAD doesn't support inner classes at the time of writing (will it ever support?)...

Discussion


Log in to post a comment.

MongoDB Logo MongoDB