KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > getahead > dwrdemo > chat > Message


1 package org.getahead.dwrdemo.chat;
2
3 /**
4  * A POJO that represents a typed message
5  * @author Joe Walker [joe at getahead dot ltd dot uk]
6  */

7 public class Message
8 {
9     /**
10      * @param newtext the new message text
11      */

12     public Message(String JavaDoc newtext)
13     {
14         text = newtext;
15
16         if (text.length() > 256)
17         {
18             text = text.substring(0, 256);
19         }
20     }
21
22     /**
23      * @return the message id
24      */

25     public long getId()
26     {
27         return id;
28     }
29
30     /**
31      * @return the message itself
32      */

33     public String JavaDoc getText()
34     {
35         return text;
36     }
37
38     /**
39      * When the message was created
40      */

41     private long id = System.currentTimeMillis();
42
43     /**
44      * The text of the message
45      */

46     private String JavaDoc text;
47 }
48
Popular Tags