Should we replacing all arrays with lists?
1) A simple statement like
ObjectAction action = spec.getObjectAction(ObjectActionType.USER,
"userFor", new ObjectSpecification[] {userid.getSpecification()});
becomes
List<ObjectSpecification> parameters = new
ArrayList<ObjectSpecification>();
parameters.add(spec);
ObjectAction action =
userAdminService.getSpecification().getObjectAction(ObjectActionType.USER,
"userFor", parameters);
Which is not much of an improvement!
2) If that was the right thing to do then java.lang.reflect.Method would
have the following method
Object invoke(Object object, List<Object> parameters)
to replace
Object invoke(Object object, Object[] parameters)
but it doesn't. My Java in a nutshell says it has this instead
Object invoke(Object object, Object... parameters)
which is an array by another name.
3) The Java people haven't suggested removing arrays from use so they
must be good for something.
Maybe (2) is a clue as to how we should be handling these situations
where all want to do is pass in a set of somthing.
Regards
Rob
On 17/12/10 16:34, Dan Haywood (JIRA) wrote:
Remove arrays from all public APIs, replace with (immutable) lists of elements.
-------------------------------------------------------------------------------
Key: ISIS-57
URL: https://issues.apache.org/jira/browse/ISIS-57
Project: Isis
Issue Type: Improvement
Reporter: Dan Haywood
This is an umbrella JIRA to steadily improve our API. If you find a change you
want to make, create a subtask under this one and action on it.
This umbrella JIRA won't get a fix version until all APIs have been impacted,
which could take some time. Individual subtasks can be assigned fix versions
as they are done.