Api xml doc generator: define if command is sync or async in the xml doc

This commit is contained in:
alena 2011-02-28 15:17:42 -08:00
parent 7c7710c204
commit be76a51dbe
3 changed files with 32 additions and 4 deletions

View File

@ -110,7 +110,6 @@ public class ApiXmlDocReader {
}
}
try {
FileWriter fstream = new FileWriter(dirName + "/diff.txt");
BufferedWriter out = new BufferedWriter(fstream);
@ -130,12 +129,25 @@ public class ApiXmlDocReader {
out.write("\nRemoved commands:\n");
for (Command c : removedCommands) {
if (c.getDescription() != null && !c.getDescription().isEmpty()) {
out.write("\n " + c.getName() + " (" + c.getDescription() + ")\n");
out.write("\n\t" + c.getName() + " (" + c.getDescription() + ")\n");
} else {
out.write("\n " + c.getName() + "\n");
out.write("\n\t" + c.getName() + "\n");
}
}
out.write("\n Changes in command type (sync versus async");
//Verify if the command was sync and became async and vice versa
for (String key : stableCommands.keySet()) {
if (commands.get(key).isAsync() != oldCommands.get(key).isAsync()) {
String type = "Sync";
if (commands.get(key).isAsync()) {
type = "Async";
}
out.write("\n\t" + stableCommands.get(key).getName() + " became " + type);
}
}
//Print differences between commands arguments
out.write("\nChanges in commands arguments:\n");

View File

@ -314,6 +314,13 @@ public class ApiXmlDocWriter {
request = setRequestFields(fields);
//Set Async information for the command
if (superName.equals(BaseAsyncCmd.class.getName()) || superName.equals(BaseAsyncCreateCmd.class.getName())) {
apiCommand.setAsync(true);
} else {
apiCommand.setAsync(false);
}
//Get response parameters
Class<?> responseClas = impl.responseObject();
Field[] responseFields = responseClas.getDeclaredFields();

View File

@ -24,6 +24,7 @@ public class Command {
private String name;
private String description;
private boolean isAsync;
private ArrayList<Argument> request;
private ArrayList<Argument> response;
@ -66,7 +67,15 @@ public class Command {
this.response = response;
}
public Argument getReqArgByName(String name){
public boolean isAsync() {
return isAsync;
}
public void setAsync(boolean isAsync) {
this.isAsync = isAsync;
}
public Argument getReqArgByName(String name){
for (Argument a : this.getRequest()) {
if (a.getName().equals(name)) {
return a;