-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGooseNest.java
97 lines (79 loc) · 2.01 KB
/
GooseNest.java
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
86
87
88
89
90
91
92
93
94
95
96
97
package com.deange.uwaterlooapi.model.resources;
import android.os.Parcel;
import android.os.Parcelable;
import com.deange.uwaterlooapi.model.BaseModel;
import com.deange.uwaterlooapi.utils.DateUtils;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
public class GooseNest
extends BaseModel
implements
Parcelable {
@SerializedName("id")
String mId;
@SerializedName("location")
String mLocationDescription;
@SerializedName("latitude")
float mLatitude;
@SerializedName("longitude")
float mLongitude;
@SerializedName("updated")
String mUpdated;
protected GooseNest(final Parcel in) {
super(in);
mId = in.readString();
mLocationDescription = in.readString();
mLatitude = in.readFloat();
mLongitude = in.readFloat();
mUpdated = in.readString();
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mId);
dest.writeString(mLocationDescription);
dest.writeFloat(mLatitude);
dest.writeFloat(mLongitude);
dest.writeString(mUpdated);
}
public static final Creator<GooseNest> CREATOR = new Creator<GooseNest>() {
@Override
public GooseNest createFromParcel(final Parcel in) {
return new GooseNest(in);
}
@Override
public GooseNest[] newArray(final int size) {
return new GooseNest[size];
}
};
/**
* Goose Nest ID
*/
public String getId() {
return mId;
}
/**
* Human-readable description of goose nest location
*/
public String getLocationDescription() {
return mLocationDescription;
}
/**
* Latitude + longitude of goose nest location
*/
public float[] getLocation() {
return new float[]{mLatitude, mLongitude};
}
/**
* ISO 8601 time-stamp of last update
*/
public Date getUpdatedDate() {
return DateUtils.parseDate(mUpdated);
}
/**
* ISO 8601 time-stamp of last update as a string
*/
public String getRawUpdatedDate() {
return mUpdated;
}
}