Home | History | Annotate | Download | only in vo
      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.Entity;
     20 import androidx.room.PrimaryKey;
     21 
     22 /**
     23  * The toys of a pet.
     24  */
     25 @Entity
     26 public class Toy {
     27     @PrimaryKey(autoGenerate = true)
     28     private int mId;
     29     private String mName;
     30     private int mPetId;
     31 
     32     public int getId() {
     33         return mId;
     34     }
     35 
     36     public void setId(int id) {
     37         mId = id;
     38     }
     39 
     40     public String getName() {
     41         return mName;
     42     }
     43 
     44     public void setName(String name) {
     45         mName = name;
     46     }
     47 
     48     public int getPetId() {
     49         return mPetId;
     50     }
     51 
     52     public void setPetId(int petId) {
     53         mPetId = petId;
     54     }
     55 
     56     @Override
     57     public boolean equals(Object o) {
     58         if (this == o) return true;
     59         if (o == null || getClass() != o.getClass()) return false;
     60 
     61         Toy toy = (Toy) o;
     62 
     63         if (mId != toy.mId) return false;
     64         if (mPetId != toy.mPetId) return false;
     65         return mName != null ? mName.equals(toy.mName) : toy.mName == null;
     66     }
     67 
     68     @Override
     69     public int hashCode() {
     70         int result = mId;
     71         result = 31 * result + (mName != null ? mName.hashCode() : 0);
     72         result = 31 * result + mPetId;
     73         return result;
     74     }
     75 }
     76