|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 package org.mozilla.gecko.fxa.login; |
|
6 |
|
7 |
|
8 public class FxAccountLoginTransition { |
|
9 public interface Transition { |
|
10 } |
|
11 |
|
12 public static class LogMessage implements Transition { |
|
13 public final String detailMessage; |
|
14 |
|
15 public LogMessage(String detailMessage) { |
|
16 this.detailMessage = detailMessage; |
|
17 } |
|
18 |
|
19 @Override |
|
20 public String toString() { |
|
21 return getClass().getSimpleName() + (this.detailMessage == null ? "" : "('" + this.detailMessage + "')"); |
|
22 } |
|
23 } |
|
24 |
|
25 public static class AccountNeedsVerification extends LogMessage { |
|
26 public AccountNeedsVerification() { |
|
27 super(null); |
|
28 } |
|
29 } |
|
30 |
|
31 public static class AccountVerified extends LogMessage { |
|
32 public AccountVerified() { |
|
33 super(null); |
|
34 } |
|
35 } |
|
36 |
|
37 public static class PasswordRequired extends LogMessage { |
|
38 public PasswordRequired() { |
|
39 super(null); |
|
40 } |
|
41 } |
|
42 |
|
43 public static class LocalError implements Transition { |
|
44 public final Exception e; |
|
45 |
|
46 public LocalError(Exception e) { |
|
47 this.e = e; |
|
48 } |
|
49 |
|
50 @Override |
|
51 public String toString() { |
|
52 return "Log(" + this.e + ")"; |
|
53 } |
|
54 } |
|
55 |
|
56 public static class RemoteError implements Transition { |
|
57 public final Exception e; |
|
58 |
|
59 public RemoteError(Exception e) { |
|
60 this.e = e; |
|
61 } |
|
62 |
|
63 @Override |
|
64 public String toString() { |
|
65 return "Log(" + (this.e == null ? "null" : this.e) + ")"; |
|
66 } |
|
67 } |
|
68 } |