|
32 | 32 | * A container that encapsulates the result of authenticating with an Identity Provider.
|
33 | 33 | */
|
34 | 34 | public class IdpResponse implements Parcelable {
|
| 35 | + public static final Creator<IdpResponse> CREATOR = new Creator<IdpResponse>() { |
| 36 | + @Override |
| 37 | + public IdpResponse createFromParcel(Parcel in) { |
| 38 | + return new IdpResponse( |
| 39 | + in.<User>readParcelable(User.class.getClassLoader()), |
| 40 | + in.readString(), |
| 41 | + in.readString(), |
| 42 | + (FirebaseUiException) in.readSerializable() |
| 43 | + ); |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public IdpResponse[] newArray(int size) { |
| 48 | + return new IdpResponse[size]; |
| 49 | + } |
| 50 | + }; |
| 51 | + |
35 | 52 | private final User mUser;
|
36 | 53 |
|
37 | 54 | private final String mToken;
|
@@ -181,22 +198,37 @@ public void writeToParcel(Parcel dest, int flags) {
|
181 | 198 | dest.writeSerializable(mException);
|
182 | 199 | }
|
183 | 200 |
|
184 |
| - public static final Creator<IdpResponse> CREATOR = new Creator<IdpResponse>() { |
185 |
| - @Override |
186 |
| - public IdpResponse createFromParcel(Parcel in) { |
187 |
| - return new IdpResponse( |
188 |
| - in.<User>readParcelable(User.class.getClassLoader()), |
189 |
| - in.readString(), |
190 |
| - in.readString(), |
191 |
| - (FirebaseUiException) in.readSerializable() |
192 |
| - ); |
193 |
| - } |
| 201 | + @Override |
| 202 | + public boolean equals(Object o) { |
| 203 | + if (this == o) return true; |
| 204 | + if (o == null || getClass() != o.getClass()) return false; |
194 | 205 |
|
195 |
| - @Override |
196 |
| - public IdpResponse[] newArray(int size) { |
197 |
| - return new IdpResponse[size]; |
198 |
| - } |
199 |
| - }; |
| 206 | + IdpResponse response = (IdpResponse) o; |
| 207 | + |
| 208 | + return (mUser == null ? response.mUser == null : mUser.equals(response.mUser)) |
| 209 | + && (mToken == null ? response.mToken == null : mToken.equals(response.mToken)) |
| 210 | + && (mSecret == null ? response.mSecret == null : mSecret.equals(response.mSecret)) |
| 211 | + && (mException == null ? response.mException == null : mException.equals(response.mException)); |
| 212 | + } |
| 213 | + |
| 214 | + @Override |
| 215 | + public int hashCode() { |
| 216 | + int result = mUser == null ? 0 : mUser.hashCode(); |
| 217 | + result = 31 * result + (mToken == null ? 0 : mToken.hashCode()); |
| 218 | + result = 31 * result + (mSecret == null ? 0 : mSecret.hashCode()); |
| 219 | + result = 31 * result + (mException == null ? 0 : mException.hashCode()); |
| 220 | + return result; |
| 221 | + } |
| 222 | + |
| 223 | + @Override |
| 224 | + public String toString() { |
| 225 | + return "IdpResponse{" + |
| 226 | + "mUser=" + mUser + |
| 227 | + ", mToken='" + mToken + '\'' + |
| 228 | + ", mSecret='" + mSecret + '\'' + |
| 229 | + ", mException=" + mException + |
| 230 | + '}'; |
| 231 | + } |
200 | 232 |
|
201 | 233 | @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
|
202 | 234 | public static class Builder {
|
|
0 commit comments