示例#1
0
 protected List<Long> readLongRepeated(JSONObject jsonObject, String fieldLabel, int fieldNumber)
     throws InvalidProtocolBufferException {
   List<Long> fieldLongRepeated = null;
   if (jsonObject != null && fieldLabel != null) {
     JSONValue fieldValue = jsonObject.get(fieldLabel);
     if (fieldValue != null) {
       JSONArray fieldJSONArray = jsonValueToArray(fieldValue);
       if (fieldJSONArray != null) {
         fieldLongRepeated = new ArrayList<Long>();
         for (int i = 0; i < fieldJSONArray.size(); ++i) {
           Long fieldLong = jsonValueToLong(fieldJSONArray.get(i));
           if (fieldLong != null) {
             fieldLongRepeated.add(fieldLong);
           } else {
             throw InvalidProtocolBufferException.failedToReadLongRepeated(fieldLabel);
           }
         }
       } else {
         throw InvalidProtocolBufferException.failedToReadLongRepeated(fieldLabel);
       }
     }
   }
   return fieldLongRepeated;
 }