List<InvocationMessage> invocationMessages = new ArrayList<InvocationMessage>();
for (AbstractRequest<?> invocation : invocations) {
// RequestData is produced by the generated subclass
RequestData data = invocation.getRequestData();
InvocationMessage message = f.invocation().as();
// Operation; essentially a method descriptor
message.setOperation(data.getOperation());
// The arguments to the with() calls
Set<String> refsToSend = data.getPropertyRefs();
if (!refsToSend.isEmpty()) {
message.setPropertyRefs(refsToSend);
}
// Parameter values or references
List<Splittable> parameters = new ArrayList<Splittable>(
data.getOrderedParameters().length);
for (Object param : data.getOrderedParameters()) {
parameters.add(EntityCodex.encode(this, param));
}
if (!parameters.isEmpty()) {
message.setParameters(parameters);
}
invocationMessages.add(message);
}
return invocationMessages;