public String getName() { return getRealName().isEmpty() ? getUserName() : getRealName(); }
@Override public JsonElement serialize(SocialUser socialUser, Type type, JsonSerializationContext jsonSerializationContext) { final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("userName", socialUser.getUserName()); jsonObject.addProperty("realName", socialUser.getRealName()); jsonObject.addProperty("email", socialUser.getEmail()); serializeList(socialUser, "following", socialUser.getFollowingName(), jsonObject); serializeList(socialUser, "followers", socialUser.getFollowersName(), jsonObject); return jsonObject; }
@Override public JsonElement serialize(SocialUser socialUser, Type type, JsonSerializationContext jsonSerializationContext) { final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("userName", socialUser.getUserName()); jsonObject.addProperty("realName", socialUser.getRealName()); jsonObject.addProperty("email", socialUser.getEmail()); serializeList(socialUser, "following", socialUser.getFollowingName(), jsonObject); serializeList(socialUser, "followers", socialUser.getFollowersName(), jsonObject); return jsonObject; }