|
|
@ -96,20 +96,15 @@ public abstract class AbstractJsonProvider implements JsonProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the keys from the given object or the indexes from an array |
|
|
|
* Returns the keys from the given object |
|
|
|
* |
|
|
|
* |
|
|
|
* @param obj an array or an object |
|
|
|
* @param obj an object |
|
|
|
* @return the keys for an object or the indexes for an array |
|
|
|
* @return the keys for an object |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public Collection<String> getPropertyKeys(Object obj) { |
|
|
|
public Collection<String> getPropertyKeys(Object obj) { |
|
|
|
if (isArray(obj)) { |
|
|
|
if (isArray(obj)) { |
|
|
|
List l = (List) obj; |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
List<String> keys = new ArrayList<String>(l.size()); |
|
|
|
|
|
|
|
for (int i = 0; i < l.size(); i++) { |
|
|
|
|
|
|
|
keys.add(String.valueOf(i)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return keys; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return ((Map) obj).keySet(); |
|
|
|
return ((Map) obj).keySet(); |
|
|
|
} |
|
|
|
} |
|
|
|