001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.data.osm; 003 004import java.util.Date; 005 006import org.openstreetmap.josm.tools.date.DateUtils; 007 008/** 009 * A comment in a public changeset discussion. 010 * @since 7704 011 */ 012public class ChangesetDiscussionComment { 013 014 /** date this comment was posted at */ 015 private final Date date; 016 /** the user who posted the comment */ 017 private final User user; 018 /** comment text */ 019 private String text; 020 021 /** 022 * Constructs a new {@code ChangesetDiscussionComment}. 023 * @param date date this comment was posted at 024 * @param user the user who posted the comment 025 */ 026 public ChangesetDiscussionComment(Date date, User user) { 027 this.date = DateUtils.cloneDate(date); 028 this.user = user; 029 } 030 031 /** 032 * Replies comment text. 033 * @return comment text 034 */ 035 public final String getText() { 036 return text; 037 } 038 039 /** 040 * Sets comment text. 041 * @param text comment text 042 */ 043 public final void setText(String text) { 044 this.text = text; 045 } 046 047 /** 048 * Replies date this comment was posted at. 049 * @return date this comment was posted at 050 */ 051 public final Date getDate() { 052 return DateUtils.cloneDate(date); 053 } 054 055 /** 056 * Replies the user who posted the comment. 057 * @return the user who posted the comment 058 */ 059 public final User getUser() { 060 return user; 061 } 062 063 @Override 064 public String toString() { 065 return "ChangesetDiscussionComment [date=" + date + ", user=" + user + ", text='" + text + "']"; 066 } 067}