KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > messageBoard > Message


1 package org.nextime.ion.backoffice.messageBoard;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.Date JavaDoc;
5
6 /**
7  * 6 janv. 2003
8  */

9 public class Message implements Serializable JavaDoc, Comparable JavaDoc {
10
11     private String JavaDoc poster;
12     private Date JavaDoc date;
13     private String JavaDoc message;
14
15     /**
16      * Returns the date.
17      * @return Date
18      */

19     public Date JavaDoc getDate() {
20         return date;
21     }
22
23     /**
24      * Returns the message.
25      * @return String
26      */

27     public String JavaDoc getMessage() {
28         return message;
29     }
30
31     /**
32      * Returns the poster.
33      * @return User
34      */

35     public String JavaDoc getPoster() {
36         return poster;
37     }
38
39     /**
40      * Sets the date.
41      * @param date The date to set
42      */

43     public void setDate(Date JavaDoc date) {
44         this.date = date;
45     }
46
47     /**
48      * Sets the message.
49      * @param message The message to set
50      */

51     public void setMessage(String JavaDoc message) {
52         this.message = message;
53     }
54
55     /**
56      * Sets the poster.
57      * @param poster The poster to set
58      */

59     public void setPoster(String JavaDoc poster) {
60         this.poster = poster;
61     }
62
63     /**
64      * un message est plus petit qu'un autre si il est plus jeune
65      */

66     public int compareTo(Object JavaDoc o) {
67         try {
68             Message m = (Message) o;
69             if (m.getDate().before(getDate())) {
70                 return -1;
71             } else {
72                 return 1;
73             }
74         } catch (Exception JavaDoc e) {
75             return -1;
76         }
77     }
78
79 }
80
Popular Tags