Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Player[
- id=1,
- _id=531029b207987409620000d6,
- battingStyle=RHB,
- bowlingStyle=RAOS,
- dob=2000-02-28T06: 15: 15.264Z,
- playingRole=BWL,
- sname=QadeerButt,
- fname=Tahir,
- gallery=[
- ],
- games=[
- Game[
- id=4,
- gameType=T20,
- name=TotallyCricketvsLahoreTiger,
- totalOvers=20,
- dateStarted=2014-06-18T19: 00: 00.000Z,
- dateEnded=2014-06-18T19: 00: 00.000Z,
- innings=[
- ],
- grounds=[
- Ground[
- id=26,
- address=14835SE18thPl,
- Bellevue,
- WA98007,
- UnitedStates,
- city=Bellevue,
- country=UnitedStates,
- name=RobinswoodPark
- ],
- Ground[
- id=26,
- address=14835SE18thPl,
- Bellevue,
- WA98007,
- UnitedStates,
- city=Bellevue,
- country=UnitedStates,
- name=RobinswoodPark
- ]
- ],
- teams=[
- Team[
- id=30,
- name=TotallyCricket,
- category=Veterans,
- teamGender=Men,
- rating=5
- ],
- Team[
- id=19,
- name=LahoreTiger,
- category=Under19,
- teamGender=Men,
- rating=3
- ]
- ]
- ]
- ]
- ]
- And player model class are
- package com.tt.models;
- import java.util.Collection;
- import com.google.gson.annotations.SerializedName;
- import com.j256.ormlite.field.DatabaseField;
- import com.j256.ormlite.field.ForeignCollectionField;
- import com.j256.ormlite.table.DatabaseTable;
- @DatabaseTable(tableName = "Player")
- public class Player {
- public static final String BATTING_ID_FIELD_NAME = "batting_id";
- public static final String BOWLING_ID_FIELD_NAME = "bowling_id";
- public static final String TEAM_ID_FIELD_NAME = "team_id";
- @SerializedName("__v")
- @DatabaseField(id = true)
- private int id;
- @SerializedName("_id")
- @DatabaseField(columnName = "_id")
- private String _id;
- /*@SerializedName("__v")
- @DatabaseField(columnName = "__v",id=true)
- private int __v;*/
- @DatabaseField
- private String battingStyle;
- @DatabaseField
- private String bowlingStyle;
- @DatabaseField
- private String dob;
- @DatabaseField
- private String playingRole;
- @DatabaseField
- private String sname;
- @DatabaseField
- private String fname;
- @SerializedName("gallery")
- @ForeignCollectionField(eager = true, maxEagerLevel = 2)
- private Collection<Gallery> gallery;
- @SerializedName("games")
- @ForeignCollectionField(eager = true)
- private Collection<Game> games;
- /*
- * @DatabaseField(dataType = DataType.SERIALIZABLE) private String[] users;
- */
- /*
- * @DatabaseField(dataType = DataType.SERIALIZABLE) private String[] squad;
- */
- Player() {
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getBattingStyle() {
- return battingStyle;
- }
- public void setBattingStyle(String battingStyle) {
- this.battingStyle = battingStyle;
- }
- public String getBowlingStyle() {
- return bowlingStyle;
- }
- public void setBowlingStyle(String bowlingStyle) {
- this.bowlingStyle = bowlingStyle;
- }
- public String getDob() {
- return dob;
- }
- public void setDob(String dob) {
- this.dob = dob;
- }
- public String getPlayingRole() {
- return playingRole;
- }
- public void setPlayingRole(String playingRole) {
- this.playingRole = playingRole;
- }
- public String getSname() {
- return sname;
- }
- public void setSname(String sname) {
- this.sname = sname;
- }
- public String getFname() {
- return fname;
- }
- public void setFname(String fname) {
- this.fname = fname;
- }
- /*
- * public String[] getUsers() { return users; }
- *
- * public void setUsers(String[] users) { this.users = users; }
- */
- /*
- * public String[] getSquad() { return squad; }
- *
- * public void setSquad(String[] squad) { this.squad = squad; }
- */
- public Collection<Gallery> getGallerys() {
- return gallery;
- }
- public void setGallerys(Collection<Gallery> gallery) {
- this.gallery = gallery;
- }
- public Collection<Gallery> getGallery() {
- return gallery;
- }
- public void setGallery(Collection<Gallery> gallery) {
- this.gallery = gallery;
- }
- public Collection<Game> getGames() {
- return games;
- }
- public void setGames(Collection<Game> games) {
- this.games = games;
- }
- public String get_id() {
- return _id;
- }
- public void set_id(String _id) {
- this._id = _id;
- }
- @Override
- public String toString() {
- return "Player [id=" + id + ", _id=" + _id + ", battingStyle="
- + battingStyle + ", bowlingStyle=" + bowlingStyle + ", dob="
- + dob + ", playingRole=" + playingRole + ", sname=" + sname
- + ", fname=" + fname + ", gallery=" + gallery + ", games="
- + games + "]";
- }
- }
- And Game model class
- package com.tt.models;
- import java.util.Collection;
- import com.google.gson.annotations.SerializedName;
- import com.j256.ormlite.field.DatabaseField;
- import com.j256.ormlite.field.ForeignCollectionField;
- import com.j256.ormlite.table.DatabaseTable;
- @DatabaseTable(tableName = "Game")
- public class Game {
- public static final String INNING_ID_FIELD_NAME = "inning_id";
- public static final String PLAYER_ID_FIELD_NAME = "player_id";
- @SerializedName("__v")
- @DatabaseField(id = true)
- private int id;
- /*
- * @SerializedName("_id")
- *
- * @DatabaseField(columnName = "_id") private String _id;
- *
- * @SerializedName("__v")
- *
- * @DatabaseField(columnName = "__v",id=true) private int __v;
- */
- @SerializedName("gameType")
- @DatabaseField
- private String gameType;
- @SerializedName("name")
- @DatabaseField
- private String name;
- @SerializedName("totalOvers")
- @DatabaseField
- private String totalOvers;
- @SerializedName("dateStarted")
- @DatabaseField
- private String dateStarted;
- @SerializedName("dateEnded")
- @DatabaseField
- private String dateEnded;
- @SerializedName("innings")
- @ForeignCollectionField(eager = true, maxEagerLevel = 2)
- private Collection<Inning> innings;
- @DatabaseField(foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true, columnName = PLAYER_ID_FIELD_NAME)
- private transient Player player;
- @SerializedName("grounds")
- @ForeignCollectionField(eager = true, maxEagerLevel = 2)
- private Collection<Ground> grounds;
- @SerializedName("teams")
- @ForeignCollectionField(eager = true, maxEagerLevel = 2)
- private Collection<Team> teams;
- public Game() {
- // all persisted classes must define a no-arg constructor with at least
- // package visibility
- }
- /*
- * public String get_id() { return _id; }
- *
- * public void set_id(String _id) { this._id = _id; }
- */
- public String getGameType() {
- return gameType;
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public void setGameType(String gameType) {
- this.gameType = gameType;
- }
- public Collection<Ground> getGrounds() {
- return grounds;
- }
- public void setGrounds(Collection<Ground> grounds) {
- this.grounds = grounds;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getDateStarted() {
- return dateStarted;
- }
- public void setDateStarted(String dateStarted) {
- this.dateStarted = dateStarted;
- }
- public String getDateEnded() {
- return dateEnded;
- }
- public void setDateEnded(String dateEnded) {
- this.dateEnded = dateEnded;
- }
- public String getTotalOvers() {
- return totalOvers;
- }
- public void setTotalOvers(String totalOvers) {
- this.totalOvers = totalOvers;
- }
- public Player getPlayer() {
- return player;
- }
- public void setPlayer(Player player) {
- this.player = player;
- }
- public Collection<Inning> getInnings() {
- return innings;
- }
- public void setInnings(Collection<Inning> innings) {
- this.innings = innings;
- }
- public Collection<Team> getTeams() {
- return teams;
- }
- public void setTeams(Collection<Team> teams) {
- this.teams = teams;
- }
- @Override
- public String toString() {
- return "Game [id=" + id + ", gameType=" + gameType + ", name=" + name
- + ", totalOvers=" + totalOvers + ", dateStarted=" + dateStarted
- + ", dateEnded=" + dateEnded + ", innings=" + innings
- + ", grounds=" + grounds + ", teams=" + teams + "]";
- }
- }
- And ground model
- package com.tt.models;
- import android.widget.Toast;
- import com.google.gson.annotations.SerializedName;
- import com.j256.ormlite.field.DatabaseField;
- import com.j256.ormlite.table.DatabaseTable;
- import com.tt.Utilities.Utils;
- @DatabaseTable(tableName = "Ground")
- public class Ground {
- public static final String GAME_ID_FIELD_NAME = "game_id";
- @SerializedName("__v")
- @DatabaseField(id = true)
- private int id;
- /*
- * @SerializedName("_id")
- *
- * @DatabaseField(columnName = "_id",unique=true) private String _id;
- *
- * @SerializedName("__v")
- *
- * @DatabaseField(columnName = "__v",id=true) private int __v;
- */
- @SerializedName("address")
- @DatabaseField
- private String address;
- @SerializedName("city")
- @DatabaseField
- private String city;
- @SerializedName("country")
- @DatabaseField
- private String country;
- @SerializedName("name")
- @DatabaseField
- private String name;
- @DatabaseField(foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true, maxForeignAutoRefreshLevel = 3, columnName = GAME_ID_FIELD_NAME)
- private transient Game game;
- public Ground() {
- // all persisted classes must define a no-arg constructor with at least
- // package visibility
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getGameType() {
- return address;
- }
- public void setGameType(String gameType) {
- this.address = gameType;
- }
- public Game getGame() {
- return game;
- }
- public void setGame(Game game) {
- this.game = game;
- }
- public String getAddress() {
- return address;
- }
- public void setAddress(String address) {
- this.address = address;
- }
- public String getCity() {
- return city;
- }
- public void setCity(String city) {
- this.city = city;
- }
- public String getCountry() {
- return country;
- }
- public void setCountry(String country) {
- this.country = country;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- @Override
- public String toString() {
- return "Ground [id=" + id + ", address=" + address + ", city=" + city
- + ", country=" + country + ", name=" + name + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement