Last active
December 11, 2015 10:48
-
-
Save galex/4589725 to your computer and use it in GitHub Desktop.
Parcelable entity with a transient CREATOR field (to be compatible with stORM)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Place implements Parcelable { | |
private long id; | |
private String title; | |
private double lat; | |
private double lng; | |
private String address; | |
private String uri; | |
private String description; | |
private String sector; | |
private String ownerName; | |
private String ownerEmail; | |
private String youtubeId; | |
private Type type; | |
// accessors | |
public Place() { | |
} | |
public void writeToParcel(Parcel dest, int flags) { | |
dest.writeLong(id); | |
dest.writeString(title); | |
dest.writeDouble(lat); | |
dest.writeDouble(lng); | |
dest.writeString(address); | |
dest.writeString(uri); | |
dest.writeString(description); | |
dest.writeString(sector); | |
dest.writeString(ownerName); | |
dest.writeString(ownerEmail); | |
dest.writeString(youtubeId); | |
dest.writeInt(type.ordinal()); | |
} | |
protected Place(Parcel in) { | |
id = in.readLong(); | |
title = in.readString(); | |
lat = in.readDouble(); | |
lng = in.readDouble(); | |
address = in.readString(); | |
uri = in.readString(); | |
description = in.readString(); | |
sector = in.readString(); | |
ownerName = in.readString(); | |
ownerEmail = in.readString(); | |
youtubeId = in.readString(); | |
type = Type.values()[in.readInt()]; | |
} | |
public int describeContents() { | |
return 0; | |
} | |
public transient static final Parcelable.Creator<Place> CREATOR = new Parcelable.Creator<Place>() { | |
public Place createFromParcel(Parcel in) { | |
return new Place(in); | |
} | |
public Place[] newArray(int size) { | |
return new Place[size]; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment