michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.fxa.login; michael@0: michael@0: michael@0: public class FxAccountLoginTransition { michael@0: public interface Transition { michael@0: } michael@0: michael@0: public static class LogMessage implements Transition { michael@0: public final String detailMessage; michael@0: michael@0: public LogMessage(String detailMessage) { michael@0: this.detailMessage = detailMessage; michael@0: } michael@0: michael@0: @Override michael@0: public String toString() { michael@0: return getClass().getSimpleName() + (this.detailMessage == null ? "" : "('" + this.detailMessage + "')"); michael@0: } michael@0: } michael@0: michael@0: public static class AccountNeedsVerification extends LogMessage { michael@0: public AccountNeedsVerification() { michael@0: super(null); michael@0: } michael@0: } michael@0: michael@0: public static class AccountVerified extends LogMessage { michael@0: public AccountVerified() { michael@0: super(null); michael@0: } michael@0: } michael@0: michael@0: public static class PasswordRequired extends LogMessage { michael@0: public PasswordRequired() { michael@0: super(null); michael@0: } michael@0: } michael@0: michael@0: public static class LocalError implements Transition { michael@0: public final Exception e; michael@0: michael@0: public LocalError(Exception e) { michael@0: this.e = e; michael@0: } michael@0: michael@0: @Override michael@0: public String toString() { michael@0: return "Log(" + this.e + ")"; michael@0: } michael@0: } michael@0: michael@0: public static class RemoteError implements Transition { michael@0: public final Exception e; michael@0: michael@0: public RemoteError(Exception e) { michael@0: this.e = e; michael@0: } michael@0: michael@0: @Override michael@0: public String toString() { michael@0: return "Log(" + (this.e == null ? "null" : this.e) + ")"; michael@0: } michael@0: } michael@0: }