Object[] requestMapKeys = requestMap.keySet().toArray();
Arrays.sort(requestMapKeys);
if (requestMap.size() == 1 && requestMapKeys[0].toString().equalsIgnoreCase("DELEGATE")) {
ComplexMapOperationResponseObjectDelegate delegate = new ComplexMapOperationResponseObjectDelegateImpl();
return new ComplexMapOperationResponseObject(delegate);
}
else {
Map<String,SomeComplexObject> responseMap = new LinkedHashMap<String,SomeComplexObject>();
for (Object key : requestMapKeys) {
SomeComplexObject responseComplexObject = new SomeComplexObject();
SomeComplexObject requestComplexObject = requestMap.get(key.toString());
responseComplexObject.setDateTimeParameter(requestComplexObject.getDateTimeParameter());
responseComplexObject.setListParameter(requestComplexObject.getListParameter());
responseComplexObject.setEnumParameter(requestComplexObject.getEnumParameter());
responseComplexObject.setStringParameter(requestComplexObject.getStringParameter());
responseMap.put(key.toString(), responseComplexObject);
}
ComplexMapOperationResponseObject response = new ComplexMapOperationResponseObject();
response.setResponseMap(responseMap);
return response;
}
}