1/* 2 * Copyright 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 17package androidx.room.integration.testapp.vo; 18 19import androidx.room.Embedded; 20import androidx.room.Ignore; 21import androidx.room.Relation; 22 23import java.util.List; 24 25public class PetWithToyIds { 26 @Embedded 27 public final Pet pet; 28 @Relation(parentColumn = "mPetId", entityColumn = "mPetId", projection = "mId", 29 entity = Toy.class) 30 public List<Integer> toyIds; 31 32 // for the relation 33 public PetWithToyIds(Pet pet) { 34 this.pet = pet; 35 } 36 37 @Ignore 38 public PetWithToyIds(Pet pet, List<Integer> toyIds) { 39 this.pet = pet; 40 this.toyIds = toyIds; 41 } 42 43 @Override 44 public boolean equals(Object o) { 45 if (this == o) return true; 46 if (o == null || getClass() != o.getClass()) return false; 47 48 PetWithToyIds that = (PetWithToyIds) o; 49 50 if (pet != null ? !pet.equals(that.pet) : that.pet != null) return false; 51 return toyIds != null ? toyIds.equals(that.toyIds) : that.toyIds == null; 52 } 53 54 @Override 55 public int hashCode() { 56 int result = pet != null ? pet.hashCode() : 0; 57 result = 31 * result + (toyIds != null ? toyIds.hashCode() : 0); 58 return result; 59 } 60 61 @Override 62 public String toString() { 63 return "PetWithToyIds{" 64 + "pet=" + pet 65 + ", toyIds=" + toyIds 66 + '}'; 67 } 68} 69