-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForumItem.java
More file actions
85 lines (68 loc) · 2.22 KB
/
ForumItem.java
File metadata and controls
85 lines (68 loc) · 2.22 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.example.ikoala.database;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class ForumItem implements Parcelable {
private String title;
private String description;
private String userId;
private Date datePosted;
private String location;
private List<Map<String, Object>> comments;
public ForumItem(){}
public ForumItem(String title, String description, String userId, Date datePosted, String location, List<Map<String, Object>> comments){
this.description = description;
this.title = title;
this.userId = userId;
this.datePosted = datePosted;
this.comments = comments;
this.location = location;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public String getUserId() {
return userId;
}
public Date getDatePosted() {return datePosted;}
public String getLocation() {return location;}
public List<Map<String, Object>> getComments() { return comments; }
@SuppressWarnings("unchecked") //prevents complaining of comments assignment
public ForumItem(Parcel in){
title = in.readString();
description = in.readString();
datePosted = (java.util.Date) in.readSerializable();
userId = in.readString();
location = in.readString();
//this might break
comments = in.readArrayList(getClass().getClassLoader());
}
public static final Creator<ForumItem> CREATOR = new Creator<ForumItem>() {
@Override
public ForumItem createFromParcel(Parcel in) {
return new ForumItem(in);
}
@Override
public ForumItem[] newArray(int size) {
return new ForumItem[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(title);
dest.writeString(description);
dest.writeSerializable(datePosted);
dest.writeString(userId);
dest.writeString(location);
dest.writeList(comments);
}
}