1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.room.integration.testapp.vo;
18 
19 import androidx.room.ColumnInfo;
20 import androidx.room.Entity;
21 import androidx.room.PrimaryKey;
22 
23 import java.util.Date;
24 
25 @Entity
26 public class Pet {
27     @PrimaryKey
28     private int mPetId;
29     private int mUserId;
30     @ColumnInfo(name = "mPetName")
31     private String mName;
32 
33     private Date mAdoptionDate;
34 
getPetId()35     public int getPetId() {
36         return mPetId;
37     }
38 
setPetId(int petId)39     public void setPetId(int petId) {
40         mPetId = petId;
41     }
42 
getName()43     public String getName() {
44         return mName;
45     }
46 
setName(String name)47     public void setName(String name) {
48         mName = name;
49     }
50 
getUserId()51     public int getUserId() {
52         return mUserId;
53     }
54 
setUserId(int userId)55     public void setUserId(int userId) {
56         mUserId = userId;
57     }
58 
getAdoptionDate()59     public Date getAdoptionDate() {
60         return mAdoptionDate;
61     }
62 
setAdoptionDate(Date adoptionDate)63     public void setAdoptionDate(Date adoptionDate) {
64         mAdoptionDate = adoptionDate;
65     }
66 
67     @Override
equals(Object o)68     public boolean equals(Object o) {
69         if (this == o) return true;
70         if (o == null || getClass() != o.getClass()) return false;
71 
72         Pet pet = (Pet) o;
73 
74         if (mPetId != pet.mPetId) return false;
75         if (mUserId != pet.mUserId) return false;
76         if (mName != null ? !mName.equals(pet.mName) : pet.mName != null) return false;
77         return mAdoptionDate != null ? mAdoptionDate.equals(pet.mAdoptionDate)
78                 : pet.mAdoptionDate == null;
79     }
80 
81     @Override
hashCode()82     public int hashCode() {
83         int result = mPetId;
84         result = 31 * result + mUserId;
85         result = 31 * result + (mName != null ? mName.hashCode() : 0);
86         result = 31 * result + (mAdoptionDate != null ? mAdoptionDate.hashCode() : 0);
87         return result;
88     }
89 
90     @Override
toString()91     public String toString() {
92         return "Pet{"
93                 + "mPetId=" + mPetId
94                 + ", mUserId=" + mUserId
95                 + ", mName='" + mName + '\''
96                 + ", mAdoptionDate=" + mAdoptionDate
97                 + '}';
98     }
99 }
100