1 package org.varienaja.comments;
2
3 import java.io.Serializable;
4
5
6
7
8
9
10
11
12 public class CommentElement implements Serializable {
13 private static final long serialVersionUID = 20080224172314L;
14
15 private String _text;
16 private long _id;
17 private char _type;
18
19
20
21
22 public CommentElement() {
23 _type = 'T';
24 _text = "";
25 _id = -1L;
26 }
27
28 public String getText() {
29 return _text;
30 }
31
32 public void setText(String text) {
33 _text = text;
34 }
35
36 public long getId() {
37 return _id;
38 }
39
40 public void setId(long id) {
41 _id = id;
42 }
43
44
45
46
47
48
49
50
51
52
53
54
55
56 public void setType(char type) {
57 _type = type;
58 }
59
60 public boolean isText() {
61 return _type=='T';
62 }
63
64 public boolean isBand() {
65 return _type=='B';
66 }
67
68 public boolean isPlaylist() {
69 return _type=='P';
70 }
71
72 public boolean isSong() {
73 return _type=='S';
74 }
75
76 public boolean isArtist() {
77 return _type=='A';
78 }
79
80 public boolean isKeyword() {
81 return _type=='K';
82 }
83
84
85
86
87
88 public Object[] getInfo() {
89 Object[] result = new Object[2];
90 result[0] = Long.valueOf(_id);
91 result[1] = _text;
92 return result;
93 }
94
95 protected String getType() {
96 return String.valueOf(_type);
97 }
98
99 public String toString() {
100 return "["+getType()+"] "+_text;
101 }
102
103 }