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.Embedded; 21 22 public class Address { 23 @ColumnInfo(name = "street") 24 private String mStreet; 25 @ColumnInfo(name = "state") 26 private String mState; 27 @ColumnInfo(name = "post_code") 28 private int mPostCode; 29 @Embedded 30 private Coordinates mCoordinates; 31 getStreet()32 public String getStreet() { 33 return mStreet; 34 } 35 setStreet(String street)36 public void setStreet(String street) { 37 mStreet = street; 38 } 39 getState()40 public String getState() { 41 return mState; 42 } 43 setState(String state)44 public void setState(String state) { 45 mState = state; 46 } 47 getPostCode()48 public int getPostCode() { 49 return mPostCode; 50 } 51 setPostCode(int postCode)52 public void setPostCode(int postCode) { 53 mPostCode = postCode; 54 } 55 getCoordinates()56 public Coordinates getCoordinates() { 57 return mCoordinates; 58 } 59 setCoordinates(Coordinates coordinates)60 public void setCoordinates(Coordinates coordinates) { 61 mCoordinates = coordinates; 62 } 63 64 @Override equals(Object o)65 public boolean equals(Object o) { 66 if (this == o) return true; 67 if (o == null || getClass() != o.getClass()) return false; 68 69 Address address = (Address) o; 70 71 if (mPostCode != address.mPostCode) return false; 72 if (mStreet != null ? !mStreet.equals(address.mStreet) : address.mStreet != null) { 73 return false; 74 } 75 if (mState != null ? !mState.equals(address.mState) : address.mState != null) { 76 return false; 77 } 78 return mCoordinates != null ? mCoordinates.equals(address.mCoordinates) 79 : address.mCoordinates == null; 80 } 81 82 @Override hashCode()83 public int hashCode() { 84 int result = mStreet != null ? mStreet.hashCode() : 0; 85 result = 31 * result + (mState != null ? mState.hashCode() : 0); 86 result = 31 * result + mPostCode; 87 result = 31 * result + (mCoordinates != null ? mCoordinates.hashCode() : 0); 88 return result; 89 } 90 } 91