mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Remove the hard-coded package assumption in Command serialization.
This commit is contained in:
parent
db65dfbb12
commit
4db84fb45e
@ -39,8 +39,6 @@ public class ArrayTypeAdaptor<T> implements JsonDeserializer<T[]>, JsonSerialize
|
||||
protected Gson _gson = null;
|
||||
|
||||
|
||||
private static final String s_pkg = Command.class.getPackage().getName() + ".";
|
||||
|
||||
public ArrayTypeAdaptor() {
|
||||
}
|
||||
|
||||
@ -53,7 +51,7 @@ public class ArrayTypeAdaptor<T> implements JsonDeserializer<T[]>, JsonSerialize
|
||||
JsonArray array = new JsonArray();
|
||||
for (T cmd : src) {
|
||||
JsonObject obj = new JsonObject();
|
||||
obj.add(cmd.getClass().getName().substring(s_pkg.length()), _gson.toJsonTree(cmd));
|
||||
obj.add(cmd.getClass().getName(), _gson.toJsonTree(cmd));
|
||||
array.add(obj);
|
||||
}
|
||||
|
||||
@ -71,7 +69,7 @@ public class ArrayTypeAdaptor<T> implements JsonDeserializer<T[]>, JsonSerialize
|
||||
JsonObject element = (JsonObject)it.next();
|
||||
Map.Entry<String, JsonElement> entry = element.entrySet().iterator().next();
|
||||
|
||||
String name = s_pkg + entry.getKey();
|
||||
String name = entry.getKey();
|
||||
Class<?> clazz;
|
||||
try {
|
||||
clazz = Class.forName(name);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user