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.Date; 24import java.util.List; 25 26public class UserAndPetAdoptionDates { 27 @Embedded 28 public final User user; 29 @Relation(entity = Pet.class, 30 parentColumn = "mId", 31 entityColumn = "mUserId", 32 projection = "mAdoptionDate") 33 public List<Date> petAdoptionDates; 34 35 public UserAndPetAdoptionDates(User user) { 36 this.user = user; 37 } 38 39 @Ignore 40 public UserAndPetAdoptionDates(User user, List<Date> petAdoptionDates) { 41 this.user = user; 42 this.petAdoptionDates = petAdoptionDates; 43 } 44 45 @Override 46 public boolean equals(Object o) { 47 if (this == o) return true; 48 if (o == null || getClass() != o.getClass()) return false; 49 50 UserAndPetAdoptionDates that = (UserAndPetAdoptionDates) o; 51 52 if (user != null ? !user.equals(that.user) : that.user != null) return false; 53 return petAdoptionDates != null ? petAdoptionDates.equals(that.petAdoptionDates) 54 : that.petAdoptionDates == null; 55 } 56 57 @Override 58 public int hashCode() { 59 int result = user != null ? user.hashCode() : 0; 60 result = 31 * result + (petAdoptionDates != null ? petAdoptionDates.hashCode() : 0); 61 return result; 62 } 63 64 @Override 65 public String toString() { 66 return "UserAndPetAdoptionDates{" 67 + "user=" + user 68 + ", petAdoptionDates=" + petAdoptionDates 69 + '}'; 70 } 71} 72