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
17package androidx.room.integration.testapp.vo;
18
19import androidx.room.Embedded;
20import androidx.room.Entity;
21import androidx.room.PrimaryKey;
22
23@Entity
24public class School {
25    @PrimaryKey
26    private int mId;
27    private String mName;
28    @Embedded(prefix = "address_")
29    public Address address;
30
31    @Embedded(prefix = "manager_")
32    private User mManager;
33
34    public int getId() {
35        return mId;
36    }
37
38    public void setId(int id) {
39        mId = id;
40    }
41
42    public Address getAddress() {
43        return address;
44    }
45
46    public void setAddress(Address address) {
47        this.address = address;
48    }
49
50    public User getManager() {
51        return mManager;
52    }
53
54    public void setManager(User manager) {
55        mManager = manager;
56    }
57
58    public String getName() {
59        return mName;
60    }
61
62    public void setName(String name) {
63        mName = name;
64    }
65
66    @Override
67    public boolean equals(Object o) {
68        if (this == o) return true;
69        if (o == null || getClass() != o.getClass()) {
70            return false;
71        }
72
73        School school = (School) o;
74
75        if (mId != school.mId) {
76            return false;
77        }
78        if (mName != null ? !mName.equals(school.mName) : school.mName != null) {
79            return false;
80        }
81        if (address != null ? !address.equals(school.address) : school.address != null) {
82            return false;
83        }
84        return mManager != null ? mManager.equals(school.mManager) : school.mManager == null;
85    }
86
87    @Override
88    public int hashCode() {
89        int result = mId;
90        result = 31 * result + (mName != null ? mName.hashCode() : 0);
91        result = 31 * result + (address != null ? address.hashCode() : 0);
92        result = 31 * result + (mManager != null ? mManager.hashCode() : 0);
93        return result;
94    }
95}
96