Skip to content

Commit

Permalink
Return array when calling replaceObject with an array
Browse files Browse the repository at this point in the history
  • Loading branch information
cheungpat committed Jun 15, 2018
1 parent 4da830b commit 2bc0a50
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion skygear/src/main/java/io/skygear/skygear/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static Object replaceObject(Object object, Map mapTable) {
} else if (object instanceof List) {
return Database.replaceObject((List)object, mapTable);
} else if (object instanceof Object[]) {
return Database.replaceObject(Arrays.asList((Object[])object), mapTable);
return Database.replaceObject((Object[])object, mapTable);
} else {
return object;
}
Expand All @@ -153,6 +153,14 @@ private static List replaceObject(List object, Map mapTable) {
return newList;
}

private static Object[] replaceObject(Object[] object, Map mapTable) {
Object[] newArray = new Object[object.length];
for (int i = 0; i < newArray.length; i++) {
newArray[i] = Database.replaceObject(object[i], mapTable);
}
return newArray;
}

private static Record replaceObject(Record object, Map mapTable) {
// TODO: It is better to create a clone of the Record object, but
// the Record class does not offer a clone method.
Expand Down

0 comments on commit 2bc0a50

Please sign in to comment.