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 static java.util.Collections.unmodifiableList;
026import java.util.ArrayList;
027import java.util.Date;
028import java.util.List;
029import com.restfb.Facebook;
030import com.restfb.types.features.HasCreatedTime;
031import com.restfb.types.features.HasFrom;
032import com.restfb.types.features.HasMessage;
033
034/**
035 * Represents the <a href="http://developers.facebook.com/docs/reference/api/note">Note Graph API type</a>.
036 *
037 * @author <a href="http://restfb.com">Mark Allen</a>
038 * @since 1.5
039 */
040public class Note extends FacebookType implements HasCreatedTime, HasFrom, HasMessage {
041  /**
042   * The ID of the user who posted the note.
043   */
044  @Facebook
045  private NamedFacebookType from;
046  /**
047   * The title of the note.
048   */
049  @Facebook
050  private String subject;
051  /**
052   * The note content, an HTML string.
053   */
054  @Facebook
055  private String message;
056  /**
057   * The note icon.
058   */
059  @Facebook
060  private String icon;
061  /**
062   * The time the note was initially published.
063   */
064  @Facebook("created_time")
065  private Date createdTime;
066  /**
067   * The time the note was last updated.
068   */
069  @Facebook("updated_time")
070  private Date updatedTime;
071  // It's possible for Facebook to return {"count":0} instead of a list of comments for whatever reason.
072  // So we have this throwaway field to hold that result. There is no need to expose this through the public API; it's
073  // here to let the JSON mapper work without erroring out.
074  @Facebook("comments")
075  private String commentsAsObject;
076  @Facebook("comments")
077  private List<Comment> comments = new ArrayList<>();
078  private static final long serialVersionUID = 1L;
079
080  /**
081   * Comments made on the note.
082   *
083   * @return Comments made on the note.
084   * @since 1.6.10
085   */
086  public List<Comment> getComments() {
087    return unmodifiableList(comments);
088  }
089
090  public boolean addComment(Comment comment) {
091    return comments.add(comment);
092  }
093
094  public boolean removeComment(Comment comment) {
095    return comments.remove(comment);
096  }
097
098  /**
099   * The ID of the user who posted the note.
100   *
101   * @return The ID of the user who posted the note.
102   */
103  @Override
104  @java.lang.SuppressWarnings("all")
105  @lombok.Generated
106  public NamedFacebookType getFrom() {
107    return this.from;
108  }
109
110  /**
111   * The ID of the user who posted the note.
112   */
113  @java.lang.SuppressWarnings("all")
114  @lombok.Generated
115  public void setFrom(final NamedFacebookType from) {
116    this.from = from;
117  }
118
119  /**
120   * The title of the note.
121   *
122   * @return The title of the note.
123   */
124  @java.lang.SuppressWarnings("all")
125  @lombok.Generated
126  public String getSubject() {
127    return this.subject;
128  }
129
130  /**
131   * The title of the note.
132   */
133  @java.lang.SuppressWarnings("all")
134  @lombok.Generated
135  public void setSubject(final String subject) {
136    this.subject = subject;
137  }
138
139  /**
140   * The note content, an HTML string.
141   *
142   * @return The note content, an HTML string.
143   */
144  @Override
145  @java.lang.SuppressWarnings("all")
146  @lombok.Generated
147  public String getMessage() {
148    return this.message;
149  }
150
151  /**
152   * The note content, an HTML string.
153   */
154  @java.lang.SuppressWarnings("all")
155  @lombok.Generated
156  public void setMessage(final String message) {
157    this.message = message;
158  }
159
160  /**
161   * The note icon.
162   *
163   * @return The note icon.
164   */
165  @java.lang.SuppressWarnings("all")
166  @lombok.Generated
167  public String getIcon() {
168    return this.icon;
169  }
170
171  /**
172   * The note icon.
173   */
174  @java.lang.SuppressWarnings("all")
175  @lombok.Generated
176  public void setIcon(final String icon) {
177    this.icon = icon;
178  }
179
180  /**
181   * The time the note was initially published.
182   *
183   * @return The time the note was initially published.
184   */
185  @Override
186  @java.lang.SuppressWarnings("all")
187  @lombok.Generated
188  public Date getCreatedTime() {
189    return this.createdTime;
190  }
191
192  /**
193   * The time the note was initially published.
194   */
195  @java.lang.SuppressWarnings("all")
196  @lombok.Generated
197  public void setCreatedTime(final Date createdTime) {
198    this.createdTime = createdTime;
199  }
200
201  /**
202   * The time the note was last updated.
203   *
204   * @return The time the note was last updated.
205   */
206  @java.lang.SuppressWarnings("all")
207  @lombok.Generated
208  public Date getUpdatedTime() {
209    return this.updatedTime;
210  }
211
212  /**
213   * The time the note was last updated.
214   */
215  @java.lang.SuppressWarnings("all")
216  @lombok.Generated
217  public void setUpdatedTime(final Date updatedTime) {
218    this.updatedTime = updatedTime;
219  }
220
221  @java.lang.SuppressWarnings("all")
222  @lombok.Generated
223  public String getCommentsAsObject() {
224    return this.commentsAsObject;
225  }
226
227  @java.lang.SuppressWarnings("all")
228  @lombok.Generated
229  public void setCommentsAsObject(final String commentsAsObject) {
230    this.commentsAsObject = commentsAsObject;
231  }
232}