示例#1
0
 protected List<Integer> readIntegerRepeated(
     JSONObject jsonObject, String fieldLabel, int fieldNumber)
     throws InvalidProtocolBufferException {
   List<Integer> fieldIntegerRepeated = null;
   if (jsonObject != null && fieldLabel != null) {
     JSONValue fieldValue = jsonObject.get(fieldLabel);
     if (fieldValue != null) {
       JSONArray fieldJSONArray = jsonValueToArray(fieldValue);
       if (fieldJSONArray != null) {
         fieldIntegerRepeated = new ArrayList<Integer>();
         for (int i = 0; i < fieldJSONArray.size(); ++i) {
           Integer fieldInteger = jsonValueToInteger(fieldJSONArray.get(i));
           if (fieldInteger != null) {
             fieldIntegerRepeated.add(fieldInteger);
           } else {
             throw InvalidProtocolBufferException.failedToReadIntegerRepeated(fieldLabel);
           }
         }
       } else {
         throw InvalidProtocolBufferException.failedToReadIntegerRepeated(fieldLabel);
       }
     }
   }
   return fieldIntegerRepeated;
 }