if (lexer.token() != JSONToken.LBRACKET) {
throw new JSONException("exepct '[', but " + JSONToken.name(lexer.token()));
}
ObjectDeserializer deserializer = null;
if (int.class == type) {
deserializer = IntegerDeserializer.instance;
lexer.nextToken(JSONToken.LITERAL_INT);
} else if (String.class == type) {
deserializer = StringDeserializer.instance;
lexer.nextToken(JSONToken.LITERAL_STRING);
} else {
deserializer = config.getDeserializer(type);
lexer.nextToken(deserializer.getFastMatchToken());
}
this.setContext(array, fieldName);
try {
for (int i = 0;; ++i) {
if (isEnabled(Feature.AllowArbitraryCommas)) {
while (lexer.token() == JSONToken.COMMA) {
lexer.nextToken();
continue;
}
}
if (lexer.token() == JSONToken.RBRACKET) {
break;
}
if (int.class == type) {
Object val = IntegerDeserializer.deserialze(this);
array.add(val);
} else if (String.class == type) {
String value;
if (lexer.token() == JSONToken.LITERAL_STRING) {
value = lexer.stringVal();
lexer.nextToken(JSONToken.COMMA);
} else {
Object obj = this.parse();
if (obj == null) {
value = null;
} else {
value = obj.toString();
}
}
array.add(value);
} else {
Object val;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
val = null;
} else {
val = deserializer.deserialze(this, type, i);
}
array.add(val);
checkListResolve(array);
}
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(deserializer.getFastMatchToken());
continue;
}
}
} finally {
this.popContext();