blob: ae7199fcc9286745b126d556aab5280caa664adc (
plain)
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
64
65
66
67
68
69
70
71
72
|
package de.danoeh.antennapod.gpoddernet.model;
public class GpodnetDevice {
private String id;
private String caption;
private DeviceType type;
private int subscriptions;
public GpodnetDevice(String id, String caption, String type,
int subscriptions) {
if (id == null) {
throw new IllegalArgumentException("ID must not be null");
}
this.id = id;
this.caption = caption;
this.type = DeviceType.fromString(type);
this.subscriptions = subscriptions;
}
@Override
public String toString() {
return "GpodnetDevice [id=" + id + ", caption=" + caption + ", type="
+ type + ", subscriptions=" + subscriptions + "]";
}
public static enum DeviceType {
DESKTOP, LAPTOP, MOBILE, SERVER, OTHER;
static DeviceType fromString(String s) {
if (s == null) {
return OTHER;
}
if (s.equals("desktop")) {
return DESKTOP;
} else if (s.equals("laptop")) {
return LAPTOP;
} else if (s.equals("mobile")) {
return MOBILE;
} else if (s.equals("server")) {
return SERVER;
} else {
return OTHER;
}
}
@Override
public String toString() {
return super.toString().toLowerCase();
}
}
public String getId() {
return id;
}
public String getCaption() {
return caption;
}
public DeviceType getType() {
return type;
}
public int getSubscriptions() {
return subscriptions;
}
}
|