-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathAppcastItem.java
More file actions
63 lines (51 loc) · 1.64 KB
/
AppcastItem.java
File metadata and controls
63 lines (51 loc) · 1.64 KB
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
63
package nodebox.versioncheck;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Properties;
public class AppcastItem {
private static final SimpleDateFormat RSSDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
private final Properties properties;
private String title;
private String description;
private Date date;
private Version version;
public AppcastItem(Properties properties) {
this.properties = properties;
try {
title = properties.getProperty(AppcastHandler.TAG_TITLE);
description = properties.getProperty(AppcastHandler.TAG_DESCRIPTION);
date = RSSDateFormat.parse(properties.getProperty(AppcastHandler.TAG_PUB_DATE));
version = new Version(properties.getProperty(AppcastHandler.TAG_APPCAST_VERSION));
} catch (ParseException e) {
e.printStackTrace();
}
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public Date getDate() {
return date;
}
public Version getVersion() {
return version;
}
public Properties getProperties() {
return properties;
}
@Override
public String toString() {
return "AppcastItem{" +
"title='" + title + '\'' +
", date=" + date +
", version='" + version + '\'' +
'}';
}
public boolean isNewerThan(Host host) {
return version.compareTo(host.getVersion()) > 0;
}
}