1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
package net.lacolaco.smileessence.entity;
import java.util.Date;
public class Event {
private final Date createdAt;
private final EnumEvent event;
private final User source;
private final Tweet targetObject;
public Event(EnumEvent e, User s) {
this(e, s, null);
}
public Event(EnumEvent e, User s, Tweet t) {
event = e;
createdAt = new Date();
source = s;
targetObject = t;
}
public Date getCreatedAt() {
return createdAt;
}
public EnumEvent getEvent() {
return event;
}
public User getSource() {
return source;
}
public Tweet getTargetObject() {
return targetObject;
}
public String getFormattedString() {
return String.format(event.getFormat(), source.getScreenName());
}
public enum EnumEvent {
FAVORITED("Favorited by %s"),
UNFAVORITED("Unfavorited by %s"),
RETWEETED("Retweeted by %s"),
MENTIONED("Replied by %s"),
FOLLOWED("Followed by %s"),
BLOCKED("Blocked by %s"),
UNBLOCKED("Unblocked by %s"),
RECEIVE_MESSAGE("Received a direct message from %s");
private final String format;
EnumEvent(String f) {
format = f;
}
public String getFormat() {
return format;
}
}
}
|