01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.getahead.dwrdemo.chat;
17:
18: /**
19: * A POJO that represents a typed message
20: * @author Joe Walker [joe at getahead dot ltd dot uk]
21: */
22: public class Message {
23: /**
24: * @param newtext the new message text
25: */
26: public Message(String newtext) {
27: text = newtext;
28:
29: if (text.length() > 256) {
30: text = text.substring(0, 256);
31: }
32: }
33:
34: /**
35: * @return the message id
36: */
37: public long getId() {
38: return id;
39: }
40:
41: /**
42: * @return the message itself
43: */
44: public String getText() {
45: return text;
46: }
47:
48: /**
49: * When the message was created
50: */
51: private long id = System.currentTimeMillis();
52:
53: /**
54: * The text of the message
55: */
56: private String text;
57: }
|