22301102 | fe5f841 | 2025-06-01 17:25:51 +0800 | [diff] [blame] | 1 | package com.pt.Item; |
| 2 | |
| 3 | import java.time.LocalDateTime; |
| 4 | |
| 5 | public class ResourceInfo { |
| 6 | |
| 7 | private int resourceId; |
| 8 | |
| 9 | private String name; |
| 10 | private double size; |
| 11 | |
| 12 | private LocalDateTime publishTime; |
| 13 | private String author; |
| 14 | |
| 15 | private String description; |
| 16 | |
| 17 | private int seedCount; |
| 18 | private int downloadCount; |
| 19 | |
| 20 | public ResourceInfo() { |
| 21 | } |
| 22 | |
| 23 | public ResourceInfo(int resourceId, String name, double size, LocalDateTime publishTime, String author) { |
| 24 | this.resourceId = resourceId; |
| 25 | this.name = name; |
| 26 | this.size = size; |
| 27 | this.publishTime = publishTime; |
| 28 | this.author = author; |
| 29 | } |
| 30 | |
| 31 | public int getResourceId() { |
| 32 | return resourceId; |
| 33 | } |
| 34 | public void setResourceId(int resourceId) { |
| 35 | this.resourceId = resourceId; |
| 36 | } |
| 37 | public String getName() { |
| 38 | return name; |
| 39 | } |
| 40 | public void setName(String name) { |
| 41 | this.name = name; |
| 42 | } |
| 43 | public double getSize() { |
| 44 | return size; |
| 45 | } |
| 46 | public void setSize(double size) { |
| 47 | this.size = size; |
| 48 | } |
| 49 | public LocalDateTime getPublishTime() { |
| 50 | return publishTime; |
| 51 | } |
| 52 | public void setPublishTime(LocalDateTime publishTime) { |
| 53 | this.publishTime = publishTime; |
| 54 | } |
| 55 | public String getAuthor() { |
| 56 | return author; |
| 57 | } |
| 58 | public void setAuthor(String author) { |
| 59 | this.author = author; |
| 60 | } |
| 61 | public String getDescription() { |
| 62 | return description; |
| 63 | } |
| 64 | public void setDescription(String description) { |
| 65 | this.description = description; |
| 66 | } |
| 67 | public int getSeedCount() { |
| 68 | return seedCount; |
| 69 | } |
| 70 | public void setSeedCount(int seedCount) { |
| 71 | this.seedCount = seedCount; |
| 72 | } |
| 73 | public int getDownloadCount() { |
| 74 | return downloadCount; |
| 75 | } |
| 76 | public void setDownloadCount(int downloadCount) { |
| 77 | this.downloadCount = downloadCount; |
| 78 | } |
| 79 | |
| 80 | /* |
| 81 | * 重写toString方法,将资源信息以JSON字符串形式返回 |
| 82 | */ |
| 83 | @Override |
| 84 | public String toString() { |
| 85 | return "{" + |
| 86 | "\"resourceId\":" + resourceId + |
| 87 | ", \"name\":\"" + name + "\"" + |
| 88 | ", \"size\":" + size + |
| 89 | ", \"publishTime\":\"" + publishTime + "\"" + |
| 90 | ", \"author\":\"" + author + "\"" + |
| 91 | ", \"description\":\"" + description + "\"" + |
| 92 | ", \"seedCount\":" + seedCount + |
| 93 | ", \"downloadCount\":" + downloadCount + |
| 94 | '}'; |
| 95 | } |
| 96 | } |