|
| 1 | +/** |
| 2 | + * |
| 3 | + */ |
| 4 | +package co.aurasphere.botmill.telegram.model; |
| 5 | + |
| 6 | +import java.io.Serializable; |
| 7 | + |
| 8 | +import com.google.gson.annotations.SerializedName; |
| 9 | + |
| 10 | +/** |
| 11 | + * This object represents an audio file to be treated as music by the Telegram |
| 12 | + * clients. |
| 13 | + * |
| 14 | + * @author Donato Rimenti |
| 15 | + * @date Dec 25, 2016 |
| 16 | + */ |
| 17 | +public class Audio implements Serializable { |
| 18 | + |
| 19 | + /** |
| 20 | + * The serial version UID. |
| 21 | + */ |
| 22 | + private static final long serialVersionUID = 1L; |
| 23 | + |
| 24 | + /** |
| 25 | + * Unique identifier for this file. |
| 26 | + */ |
| 27 | + @SerializedName("file_id") |
| 28 | + private String fileId; |
| 29 | + |
| 30 | + /** |
| 31 | + * Duration of the audio in seconds as defined by sender. |
| 32 | + */ |
| 33 | + private int duration; |
| 34 | + |
| 35 | + /** |
| 36 | + * Optional. Performer of the audio as defined by sender or by audio tags. |
| 37 | + */ |
| 38 | + private String performer; |
| 39 | + |
| 40 | + /** |
| 41 | + * Optional. Performer of the audio as defined by sender or by audio tags. |
| 42 | + */ |
| 43 | + private String title; |
| 44 | + |
| 45 | + /** |
| 46 | + * Optional. MIME type of the file as defined by sender. |
| 47 | + */ |
| 48 | + @SerializedName("mime_type") |
| 49 | + private String mimeType; |
| 50 | + |
| 51 | + /** |
| 52 | + * Optional. File size. |
| 53 | + */ |
| 54 | + @SerializedName("file_size") |
| 55 | + private String fileSize; |
| 56 | + |
| 57 | + /** |
| 58 | + * Gets the {@link #fileId}. |
| 59 | + * |
| 60 | + * @return the {@link #fileId}. |
| 61 | + */ |
| 62 | + public String getFileId() { |
| 63 | + return fileId; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Sets the {@link #fileId}. |
| 68 | + * |
| 69 | + * @param fileId the {@link #fileId} to set. |
| 70 | + */ |
| 71 | + public void setFileId(String fileId) { |
| 72 | + this.fileId = fileId; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Gets the {@link #duration}. |
| 77 | + * |
| 78 | + * @return the {@link #duration}. |
| 79 | + */ |
| 80 | + public int getDuration() { |
| 81 | + return duration; |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * Sets the {@link #duration}. |
| 86 | + * |
| 87 | + * @param duration the {@link #duration} to set. |
| 88 | + */ |
| 89 | + public void setDuration(int duration) { |
| 90 | + this.duration = duration; |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * Gets the {@link #performer}. |
| 95 | + * |
| 96 | + * @return the {@link #performer}. |
| 97 | + */ |
| 98 | + public String getPerformer() { |
| 99 | + return performer; |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * Sets the {@link #performer}. |
| 104 | + * |
| 105 | + * @param performer the {@link #performer} to set. |
| 106 | + */ |
| 107 | + public void setPerformer(String performer) { |
| 108 | + this.performer = performer; |
| 109 | + } |
| 110 | + |
| 111 | + /** |
| 112 | + * Gets the {@link #title}. |
| 113 | + * |
| 114 | + * @return the {@link #title}. |
| 115 | + */ |
| 116 | + public String getTitle() { |
| 117 | + return title; |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * Sets the {@link #title}. |
| 122 | + * |
| 123 | + * @param title the {@link #title} to set. |
| 124 | + */ |
| 125 | + public void setTitle(String title) { |
| 126 | + this.title = title; |
| 127 | + } |
| 128 | + |
| 129 | + /** |
| 130 | + * Gets the {@link #mimeType}. |
| 131 | + * |
| 132 | + * @return the {@link #mimeType}. |
| 133 | + */ |
| 134 | + public String getMimeType() { |
| 135 | + return mimeType; |
| 136 | + } |
| 137 | + |
| 138 | + /** |
| 139 | + * Sets the {@link #mimeType}. |
| 140 | + * |
| 141 | + * @param mimeType the {@link #mimeType} to set. |
| 142 | + */ |
| 143 | + public void setMimeType(String mimeType) { |
| 144 | + this.mimeType = mimeType; |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * Gets the {@link #fileSize}. |
| 149 | + * |
| 150 | + * @return the {@link #fileSize}. |
| 151 | + */ |
| 152 | + public String getFileSize() { |
| 153 | + return fileSize; |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Sets the {@link #fileSize}. |
| 158 | + * |
| 159 | + * @param fileSize the {@link #fileSize} to set. |
| 160 | + */ |
| 161 | + public void setFileSize(String fileSize) { |
| 162 | + this.fileSize = fileSize; |
| 163 | + } |
| 164 | + |
| 165 | + /* (non-Javadoc) |
| 166 | + * @see java.lang.Object#hashCode() |
| 167 | + */ |
| 168 | + @Override |
| 169 | + public int hashCode() { |
| 170 | + final int prime = 31; |
| 171 | + int result = 1; |
| 172 | + result = prime * result + duration; |
| 173 | + result = prime * result + ((fileId == null) ? 0 : fileId.hashCode()); |
| 174 | + result = prime * result |
| 175 | + + ((fileSize == null) ? 0 : fileSize.hashCode()); |
| 176 | + result = prime * result |
| 177 | + + ((mimeType == null) ? 0 : mimeType.hashCode()); |
| 178 | + result = prime * result |
| 179 | + + ((performer == null) ? 0 : performer.hashCode()); |
| 180 | + result = prime * result + ((title == null) ? 0 : title.hashCode()); |
| 181 | + return result; |
| 182 | + } |
| 183 | + |
| 184 | + /* (non-Javadoc) |
| 185 | + * @see java.lang.Object#equals(java.lang.Object) |
| 186 | + */ |
| 187 | + @Override |
| 188 | + public boolean equals(Object obj) { |
| 189 | + if (this == obj) |
| 190 | + return true; |
| 191 | + if (obj == null) |
| 192 | + return false; |
| 193 | + if (getClass() != obj.getClass()) |
| 194 | + return false; |
| 195 | + Audio other = (Audio) obj; |
| 196 | + if (duration != other.duration) |
| 197 | + return false; |
| 198 | + if (fileId == null) { |
| 199 | + if (other.fileId != null) |
| 200 | + return false; |
| 201 | + } else if (!fileId.equals(other.fileId)) |
| 202 | + return false; |
| 203 | + if (fileSize == null) { |
| 204 | + if (other.fileSize != null) |
| 205 | + return false; |
| 206 | + } else if (!fileSize.equals(other.fileSize)) |
| 207 | + return false; |
| 208 | + if (mimeType == null) { |
| 209 | + if (other.mimeType != null) |
| 210 | + return false; |
| 211 | + } else if (!mimeType.equals(other.mimeType)) |
| 212 | + return false; |
| 213 | + if (performer == null) { |
| 214 | + if (other.performer != null) |
| 215 | + return false; |
| 216 | + } else if (!performer.equals(other.performer)) |
| 217 | + return false; |
| 218 | + if (title == null) { |
| 219 | + if (other.title != null) |
| 220 | + return false; |
| 221 | + } else if (!title.equals(other.title)) |
| 222 | + return false; |
| 223 | + return true; |
| 224 | + } |
| 225 | + |
| 226 | + /* (non-Javadoc) |
| 227 | + * @see java.lang.Object#toString() |
| 228 | + */ |
| 229 | + @Override |
| 230 | + public String toString() { |
| 231 | + return "Audio [fileId=" + fileId + ", duration=" + duration |
| 232 | + + ", performer=" + performer + ", title=" + title |
| 233 | + + ", mimeType=" + mimeType + ", fileSize=" + fileSize + "]"; |
| 234 | + } |
| 235 | + |
| 236 | +} |
0 commit comments