|
4 | 4 | package com.microsoft.aad.msal4j; |
5 | 5 |
|
6 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; |
7 | | -import lombok.*; |
8 | | -import lombok.experimental.Accessors; |
9 | 7 |
|
10 | 8 | import java.io.Serializable; |
11 | 9 | import java.util.ArrayList; |
12 | 10 | import java.util.List; |
13 | | -import java.util.Map; |
| 11 | +import java.util.Objects; |
14 | 12 |
|
15 | | -@Accessors(fluent = true) |
16 | | -@Getter |
17 | | -@Setter |
18 | | -@EqualsAndHashCode |
19 | 13 | class AccountCacheEntity implements Serializable { |
20 | 14 |
|
21 | 15 | static final String MSSTS_ACCOUNT_TYPE = "MSSTS"; |
@@ -106,4 +100,111 @@ static AccountCacheEntity create(String clientInfoStr, Authority requestAuthorit |
106 | 100 | IAccount toAccount() { |
107 | 101 | return new Account(homeAccountId, environment, username, null); |
108 | 102 | } |
| 103 | + |
| 104 | + String homeAccountId() { |
| 105 | + return this.homeAccountId; |
| 106 | + } |
| 107 | + |
| 108 | + String environment() { |
| 109 | + return this.environment; |
| 110 | + } |
| 111 | + |
| 112 | + String realm() { |
| 113 | + return this.realm; |
| 114 | + } |
| 115 | + |
| 116 | + String localAccountId() { |
| 117 | + return this.localAccountId; |
| 118 | + } |
| 119 | + |
| 120 | + String username() { |
| 121 | + return this.username; |
| 122 | + } |
| 123 | + |
| 124 | + String name() { |
| 125 | + return this.name; |
| 126 | + } |
| 127 | + |
| 128 | + String clientInfoStr() { |
| 129 | + return this.clientInfoStr; |
| 130 | + } |
| 131 | + |
| 132 | + String userAssertionHash() { |
| 133 | + return this.userAssertionHash; |
| 134 | + } |
| 135 | + |
| 136 | + String authorityType() { |
| 137 | + return this.authorityType; |
| 138 | + } |
| 139 | + |
| 140 | + void homeAccountId(String homeAccountId) { |
| 141 | + this.homeAccountId = homeAccountId; |
| 142 | + } |
| 143 | + |
| 144 | + void environment(String environment) { |
| 145 | + this.environment = environment; |
| 146 | + } |
| 147 | + |
| 148 | + void realm(String realm) { |
| 149 | + this.realm = realm; |
| 150 | + } |
| 151 | + |
| 152 | + void localAccountId(String localAccountId) { |
| 153 | + this.localAccountId = localAccountId; |
| 154 | + } |
| 155 | + |
| 156 | + void username(String username) { |
| 157 | + this.username = username; |
| 158 | + } |
| 159 | + |
| 160 | + void name(String name) { |
| 161 | + this.name = name; |
| 162 | + } |
| 163 | + |
| 164 | + void clientInfoStr(String clientInfoStr) { |
| 165 | + this.clientInfoStr = clientInfoStr; |
| 166 | + } |
| 167 | + |
| 168 | + void userAssertionHash(String userAssertionHash) { |
| 169 | + this.userAssertionHash = userAssertionHash; |
| 170 | + } |
| 171 | + |
| 172 | + void authorityType(String authorityType) { |
| 173 | + this.authorityType = authorityType; |
| 174 | + } |
| 175 | + |
| 176 | + //These methods are based on those generated by Lombok's @EqualsAndHashCode annotation. |
| 177 | + //They have the same functionality as the generated methods, but were refactored for readability. |
| 178 | + @Override |
| 179 | + public boolean equals(Object o) { |
| 180 | + if (this == o) return true; |
| 181 | + if (!(o instanceof AccountCacheEntity)) return false; |
| 182 | + |
| 183 | + AccountCacheEntity other = (AccountCacheEntity) o; |
| 184 | + |
| 185 | + if (!Objects.equals(homeAccountId(), other.homeAccountId())) return false; |
| 186 | + if (!Objects.equals(environment(), other.environment())) return false; |
| 187 | + if (!Objects.equals(realm(), other.realm())) return false; |
| 188 | + if (!Objects.equals(localAccountId(), other.localAccountId())) return false; |
| 189 | + if (!Objects.equals(username(), other.username())) return false; |
| 190 | + if (!Objects.equals(name(), other.name())) return false; |
| 191 | + if (!Objects.equals(clientInfoStr(), other.clientInfoStr())) return false; |
| 192 | + if (!Objects.equals(userAssertionHash(), other.userAssertionHash())) return false; |
| 193 | + return Objects.equals(authorityType(), other.authorityType()); |
| 194 | + } |
| 195 | + |
| 196 | + @Override |
| 197 | + public int hashCode() { |
| 198 | + int result = 1; |
| 199 | + result = result * 59 + (this.homeAccountId == null ? 43 : this.homeAccountId.hashCode()); |
| 200 | + result = result * 59 + (this.environment == null ? 43 : this.environment.hashCode()); |
| 201 | + result = result * 59 + (this.realm == null ? 43 : this.realm.hashCode()); |
| 202 | + result = result * 59 + (this.localAccountId == null ? 43 : this.localAccountId.hashCode()); |
| 203 | + result = result * 59 + (this.username == null ? 43 : this.username.hashCode()); |
| 204 | + result = result * 59 + (this.name() == null ? 43 : this.name().hashCode()); |
| 205 | + result = result * 59 + (this.clientInfoStr == null ? 43 : this.clientInfoStr.hashCode()); |
| 206 | + result = result * 59 + (this.userAssertionHash == null ? 43 : this.userAssertionHash.hashCode()); |
| 207 | + result = result * 59 + (this.authorityType == null ? 43 : this.authorityType.hashCode()); |
| 208 | + return result; |
| 209 | + } |
109 | 210 | } |
0 commit comments