return null;
}
if (object.getClass() != JSONArray.class) {
throw new CodecExceptionLineNumber(object.toString() + " not an instance of JSONArray for class " + type, info);
}
JSONArray array = (JSONArray) object;
T value = (T) Array.newInstance(type, array.length());
if (type == byte.class || type == Byte.class) {
for (int i = 0; i < array.length(); i++) {
Array.set(value, i, (byte) array.getInt(i));
}
} else {
for (int i = 0; i < array.length(); i++) {
Object element = decodeObjectInternal(type, array.opt(i), array.getLineNumber(i), warnings);
try {
Array.set(value, i, element);
} catch (IllegalArgumentException ex) {
throw new CodecExceptionLineNumber("Element " + i + " with value " +
array.opt(i).toString() + " cannot be converted to " + type.toString(),
array.getLineNumber(i));
}
}
}
return value;
}