001// Generated by delombok at Thu Aug 13 13:56:44 UTC 2026 002/* 003 * Copyright (c) 2010-2026 Mark Allen, Norbert Bartels. 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a copy 006 * of this software and associated documentation files (the "Software"), to deal 007 * in the Software without restriction, including without limitation the rights 008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 009 * copies of the Software, and to permit persons to whom the Software is 010 * furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 021 * THE SOFTWARE. 022 */ 023package com.restfb.types; 024 025import java.util.Date; 026import com.restfb.Facebook; 027import com.restfb.JsonMapper.JsonMappingCompleted; 028import com.restfb.json.Json; 029import com.restfb.json.JsonObject; 030import com.restfb.types.ads.AppLinks; 031 032/** 033 * Represents an external URL as it relates to the Facebook social graph - shares and comments from the URL on Facebook, 034 * and any Open Graph objects associated with the URL. 035 * 036 * Represents the <a href="https://developers.facebook.com/docs/graph-api/reference/url">URL Graph API type</a>. 037 * 038 * Facebook APi Version 2.1+ 039 * 040 * @since 1.7.0 041 */ 042public class Url extends FacebookType { 043 /** 044 * The Open Graph object that is canonically associated with this URL. 045 */ 046 @Facebook("og_object") 047 private OGObject ogObject; 048 /** 049 * AppLinks data associated with this URL. 050 */ 051 @Facebook("app_links") 052 private AppLinks appLinks; 053 @Facebook("share") 054 private String share; 055 @Facebook("engagement") 056 private String engagement; 057 /** 058 * The sum of comments on posts containing this URL on Facebook. 059 */ 060 private int commentCount; 061 /** 062 * The total shares of this URL all over Facebook. 063 * 064 * is set <code>0</code> if the share count is not present 065 */ 066 private int shareCount; 067 /** 068 * The sum of reactions across all posts containing the URL on Facebook. 069 */ 070 private int reactionCount; 071 /** 072 * The number shown in the comments plugin associated with the URL. This number does not include comments made on 073 * posts on Facebook. 074 */ 075 private int commentPluginCount; 076 077 @JsonMappingCompleted 078 void fillCounts() { 079 if (this.share != null) { 080 JsonObject shareObject = Json.parse(this.share).asObject(); 081 commentCount = shareObject.getInt("comment_count", commentCount); 082 shareCount = shareObject.getInt("share_count", shareCount); 083 } 084 if (this.engagement != null) { 085 JsonObject engagementObject = Json.parse(this.engagement).asObject(); 086 commentCount = engagementObject.getInt("comment_count", commentCount); 087 shareCount = engagementObject.getInt("share_count", shareCount); 088 reactionCount = engagementObject.getInt("reaction_count", reactionCount); 089 commentPluginCount = engagementObject.getInt("comment_plugin_count", commentPluginCount); 090 } 091 } 092 093 private static final long serialVersionUID = 1L; 094 095 096 /** 097 * The Open Graph object that is canonically associated with this URL. 098 */ 099 public static class OGObject extends FacebookType { 100 private static final long serialVersionUID = 1L; 101 /** 102 * The description of the object. 103 */ 104 @Facebook 105 private String description; 106 /** 107 * The title of the object. 108 */ 109 @Facebook 110 private String title; 111 /** 112 * The object type. 113 */ 114 @Facebook 115 private String type; 116 /** 117 * This URL. 118 */ 119 @Facebook 120 private String url; 121 /** 122 * When the object was last updated. 123 */ 124 @Facebook("updated_time") 125 private Date updatedTime; 126 /** 127 * The image url 128 */ 129 @Facebook 130 private String image; 131 132 /** 133 * @return The description of the object 134 */ 135 @java.lang.SuppressWarnings("all") 136 @lombok.Generated 137 public String getDescription() { 138 return this.description; 139 } 140 141 /** 142 * The description of the object. 143 */ 144 @java.lang.SuppressWarnings("all") 145 @lombok.Generated 146 public void setDescription(final String description) { 147 this.description = description; 148 } 149 150 /** 151 * @return The title of the object 152 */ 153 @java.lang.SuppressWarnings("all") 154 @lombok.Generated 155 public String getTitle() { 156 return this.title; 157 } 158 159 /** 160 * The title of the object. 161 */ 162 @java.lang.SuppressWarnings("all") 163 @lombok.Generated 164 public void setTitle(final String title) { 165 this.title = title; 166 } 167 168 /** 169 * @return The object type as String 170 */ 171 @java.lang.SuppressWarnings("all") 172 @lombok.Generated 173 public String getType() { 174 return this.type; 175 } 176 177 /** 178 * The object type. 179 */ 180 @java.lang.SuppressWarnings("all") 181 @lombok.Generated 182 public void setType(final String type) { 183 this.type = type; 184 } 185 186 /** 187 * @return This URL 188 */ 189 @java.lang.SuppressWarnings("all") 190 @lombok.Generated 191 public String getUrl() { 192 return this.url; 193 } 194 195 /** 196 * This URL. 197 */ 198 @java.lang.SuppressWarnings("all") 199 @lombok.Generated 200 public void setUrl(final String url) { 201 this.url = url; 202 } 203 204 /** 205 * @return date when the object was last updated. 206 */ 207 @java.lang.SuppressWarnings("all") 208 @lombok.Generated 209 public Date getUpdatedTime() { 210 return this.updatedTime; 211 } 212 213 /** 214 * When the object was last updated. 215 */ 216 @java.lang.SuppressWarnings("all") 217 @lombok.Generated 218 public void setUpdatedTime(final Date updatedTime) { 219 this.updatedTime = updatedTime; 220 } 221 222 /** 223 * @return image url 224 */ 225 @java.lang.SuppressWarnings("all") 226 @lombok.Generated 227 public String getImage() { 228 return this.image; 229 } 230 231 /** 232 * The image url 233 */ 234 @java.lang.SuppressWarnings("all") 235 @lombok.Generated 236 public void setImage(final String image) { 237 this.image = image; 238 } 239 } 240 241 /** 242 * The Open Graph object that is canonically associated with this URL. 243 * 244 * @return The Open Graph object that is canonically associated with this URL 245 */ 246 @java.lang.SuppressWarnings("all") 247 @lombok.Generated 248 public OGObject getOgObject() { 249 return this.ogObject; 250 } 251 252 /** 253 * The Open Graph object that is canonically associated with this URL. 254 */ 255 @java.lang.SuppressWarnings("all") 256 @lombok.Generated 257 public void setOgObject(final OGObject ogObject) { 258 this.ogObject = ogObject; 259 } 260 261 /** 262 * @return AppLinks data associated with this URL. 263 */ 264 @java.lang.SuppressWarnings("all") 265 @lombok.Generated 266 public AppLinks getAppLinks() { 267 return this.appLinks; 268 } 269 270 /** 271 * AppLinks data associated with this URL. 272 */ 273 @java.lang.SuppressWarnings("all") 274 @lombok.Generated 275 public void setAppLinks(final AppLinks appLinks) { 276 this.appLinks = appLinks; 277 } 278 279 /** 280 * @return The sum of comments on posts containing this URL on Facebook. 281 */ 282 @java.lang.SuppressWarnings("all") 283 @lombok.Generated 284 public int getCommentCount() { 285 return this.commentCount; 286 } 287 288 /** 289 * The sum of comments on posts containing this URL on Facebook. 290 */ 291 @java.lang.SuppressWarnings("all") 292 @lombok.Generated 293 public void setCommentCount(final int commentCount) { 294 this.commentCount = commentCount; 295 } 296 297 /** 298 * @return The total shares of this URL all over Facebook. 299 */ 300 @java.lang.SuppressWarnings("all") 301 @lombok.Generated 302 public int getShareCount() { 303 return this.shareCount; 304 } 305 306 /** 307 * The total shares of this URL all over Facebook. 308 * 309 * is set <code>0</code> if the share count is not present 310 */ 311 @java.lang.SuppressWarnings("all") 312 @lombok.Generated 313 public void setShareCount(final int shareCount) { 314 this.shareCount = shareCount; 315 } 316 317 /** 318 * @return The sum of reactions across all posts containing the URL on Facebook. 319 */ 320 @java.lang.SuppressWarnings("all") 321 @lombok.Generated 322 public int getReactionCount() { 323 return this.reactionCount; 324 } 325 326 /** 327 * The sum of reactions across all posts containing the URL on Facebook. 328 */ 329 @java.lang.SuppressWarnings("all") 330 @lombok.Generated 331 public void setReactionCount(final int reactionCount) { 332 this.reactionCount = reactionCount; 333 } 334 335 /** 336 * @return The number shown in the comments plugin associated with the URL. This number does not include comments made 337 * on posts on Facebook. 338 */ 339 @java.lang.SuppressWarnings("all") 340 @lombok.Generated 341 public int getCommentPluginCount() { 342 return this.commentPluginCount; 343 } 344 345 /** 346 * The number shown in the comments plugin associated with the URL. This number does not include comments made on 347 * posts on Facebook. 348 */ 349 @java.lang.SuppressWarnings("all") 350 @lombok.Generated 351 public void setCommentPluginCount(final int commentPluginCount) { 352 this.commentPluginCount = commentPluginCount; 353 } 354}