1 29 30 package echo2example.chatserver; 31 32 35 public class Message { 36 37 private static int nextId = 0; 38 39 private String userName; 40 private long postTime; 41 private String content; 42 private long id; 43 44 50 public Message(String userName, String content) { 51 super(); 52 this.userName = userName; 53 this.content = content; 54 postTime = System.currentTimeMillis(); 55 id = ++nextId; 56 } 57 58 63 public String getContent() { 64 return content; 65 } 66 67 72 public long getId() { 73 return id; 74 } 75 76 81 public String getUserName() { 82 return userName; 83 } 84 85 90 public long getPostTime() { 91 return postTime; 92 } 93 } 94 | Popular Tags |