|
|
@ -31,7 +31,6 @@ public class GsonProvider extends AbstractJsonProvider { |
|
|
|
|
|
|
|
|
|
|
|
public static Object unwrap(Object o) { |
|
|
|
public static Object unwrap(Object o) { |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("unwrap " + o); |
|
|
|
|
|
|
|
if (o == null) { |
|
|
|
if (o == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -111,7 +110,6 @@ public class GsonProvider extends AbstractJsonProvider { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Object getArrayIndex(Object obj, int idx) { |
|
|
|
public Object getArrayIndex(Object obj, int idx) { |
|
|
|
System.out.println("getArrayIndex " + obj + " (" + obj.getClass() + ")"); |
|
|
|
|
|
|
|
return unwrap(toJsonArray(obj).get(idx)); |
|
|
|
return unwrap(toJsonArray(obj).get(idx)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -149,14 +147,12 @@ public class GsonProvider extends AbstractJsonProvider { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean isMap(Object obj) { |
|
|
|
public boolean isMap(Object obj) { |
|
|
|
System.out.println("isMap " + obj + " (" + obj.getClass() + ")"); |
|
|
|
|
|
|
|
//return (obj instanceof JsonObject || obj instanceof Map);
|
|
|
|
//return (obj instanceof JsonObject || obj instanceof Map);
|
|
|
|
return (obj instanceof JsonObject); |
|
|
|
return (obj instanceof JsonObject); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Collection<String> getPropertyKeys(Object obj) { |
|
|
|
public Collection<String> getPropertyKeys(Object obj) { |
|
|
|
System.out.println("getPropertyKeys " + obj); |
|
|
|
|
|
|
|
List<String> keys = new ArrayList<String>(); |
|
|
|
List<String> keys = new ArrayList<String>(); |
|
|
|
for (Map.Entry<String, JsonElement> entry : toJsonObject(obj).entrySet()) { |
|
|
|
for (Map.Entry<String, JsonElement> entry : toJsonObject(obj).entrySet()) { |
|
|
|
keys.add(entry.getKey()); |
|
|
|
keys.add(entry.getKey()); |
|
|
@ -166,7 +162,6 @@ public class GsonProvider extends AbstractJsonProvider { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int length(Object obj) { |
|
|
|
public int length(Object obj) { |
|
|
|
System.out.println("length " + obj); |
|
|
|
|
|
|
|
if (isArray(obj)) { |
|
|
|
if (isArray(obj)) { |
|
|
|
return toJsonArray(obj).size(); |
|
|
|
return toJsonArray(obj).size(); |
|
|
|
} else if (isMap(obj)) { |
|
|
|
} else if (isMap(obj)) { |
|
|
@ -184,7 +179,6 @@ public class GsonProvider extends AbstractJsonProvider { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Iterable<?> toIterable(Object obj) { |
|
|
|
public Iterable<?> toIterable(Object obj) { |
|
|
|
System.out.println("toIterable " + obj + " (" + obj.getClass() + ")"); |
|
|
|
|
|
|
|
if (isArray(obj)) { |
|
|
|
if (isArray(obj)) { |
|
|
|
JsonArray arr = toJsonArray(obj); |
|
|
|
JsonArray arr = toJsonArray(obj); |
|
|
|
List<Object> values = new ArrayList<Object>(arr.size()); |
|
|
|
List<Object> values = new ArrayList<Object>(arr.size()); |
|
|
|