in src/main/java/com/googlesource/gerrit/plugins/multisite/forwarder/CacheKeyJsonParser.java [36:71]
public Object from(String cacheName, Object cacheKeyValue) {
Object parsedKey;
// Need to add a case for 'adv_bases'
switch (cacheName) {
case Constants.ACCOUNTS:
parsedKey = Account.id(jsonElement(cacheKeyValue).getAsJsonObject().get("id").getAsInt());
break;
case Constants.GROUPS:
parsedKey =
AccountGroup.id(jsonElement(cacheKeyValue).getAsJsonObject().get("id").getAsInt());
break;
case Constants.GROUPS_BYINCLUDE:
case Constants.GROUPS_MEMBERS:
parsedKey =
AccountGroup.uuid(
jsonElement(cacheKeyValue).getAsJsonObject().get("uuid").getAsString());
break;
case Constants.PROJECTS:
parsedKey = Project.nameKey(nullToEmpty(cacheKeyValue));
break;
case Constants.PROJECT_LIST:
parsedKey = gson.fromJson(nullToEmpty(cacheKeyValue).toString(), Object.class);
break;
default:
if (cacheKeyValue instanceof String) {
parsedKey = (String) cacheKeyValue;
} else {
try {
parsedKey = gson.fromJson(nullToEmpty(cacheKeyValue).toString().trim(), String.class);
} catch (Exception e) {
parsedKey = gson.fromJson(nullToEmpty(cacheKeyValue).toString(), Object.class);
}
}
}
return parsedKey;
}