Package org.forgerock.android.auth
Class Account
- java.lang.Object
-
- org.forgerock.android.auth.Account
-
- All Implemented Interfaces:
java.lang.Comparable<Account>
public class Account extends java.lang.ObjectAccount model represents an identity for the user with an issuer. It is possible for a user to have multiple accounts provided by a single issuer, however it is not possible to have multiple accounts from with same issuer for the same account name.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAccount.AccountBuilderBuilder class responsible for producing Accounts.
-
Constructor Summary
Constructors Constructor Description Account(java.lang.String issuer, java.lang.String displayIssuer, java.lang.String accountName, java.lang.String displayAccountName, java.lang.String imageURL, java.lang.String backgroundColor, java.util.Calendar timeAdded)Creates Account object with given information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Account.AccountBuilderbuilder()Returns a builder for creating an Account.intcompareTo(Account another)static Accountdeserialize(java.lang.String jsonString)Deserializes the specified Json into an object of theAccountobject.booleanequals(java.lang.Object o)java.lang.StringgetAccountName()Returns the name of this account.java.lang.StringgetBackgroundColor()Gets the background color for the IDP that issued this account.java.lang.StringgetDisplayAccountName()Returns the name of this account.java.lang.StringgetDisplayIssuer()Gets the alternative name of the IDP that issued this account.java.lang.StringgetId()Gets the unique identifier for the Account.java.lang.StringgetImageURL()Gets the image URL for the IDP that issued this account.java.lang.StringgetIssuer()Gets the name of the IDP that issued this account.java.util.List<Mechanism>getMechanisms()Get the list of mechanisms associates with this account.java.util.CalendargetTimeAdded()Get the Date and Time this Account was stored.inthashCode()booleanmatches(Account other)Returns true if the two objects would conflict if added to a storage system.voidsetDisplayAccountName(java.lang.String accountName)Sets an alternative name for the account.voidsetDisplayIssuer(java.lang.String issuer)Sets an alternative Issuer for this account.java.lang.StringtoJson()Creates a JSON string representation ofModelObjectobject.
-
-
-
Constructor Detail
-
Account
public Account(java.lang.String issuer, java.lang.String displayIssuer, java.lang.String accountName, java.lang.String displayAccountName, java.lang.String imageURL, java.lang.String backgroundColor, java.util.Calendar timeAdded)Creates Account object with given information.- Parameters:
issuer- String value of issuerdisplayIssuer- String alternative value of the issueraccountName- String value of accountName or usernamedisplayAccountName- String alternative value of the accountNameimageURL- URL of account's logo image (optional)backgroundColor- String HEX code of account's background color (optional)timeAdded- Date and Time this Account was stored
-
-
Method Detail
-
builder
public static Account.AccountBuilder builder()
Returns a builder for creating an Account.- Returns:
- The Account builder.
-
getId
public java.lang.String getId()
Gets the unique identifier for the Account.- Returns:
- The unique identifier.
-
getIssuer
public java.lang.String getIssuer()
Gets the name of the IDP that issued this account.- Returns:
- The name of the IDP.
-
getDisplayIssuer
public java.lang.String getDisplayIssuer()
Gets the alternative name of the IDP that issued this account. Returns originalissuerifdisplayIssueris not set.- Returns:
- The name of the IDP.
-
setDisplayIssuer
public void setDisplayIssuer(@NonNull java.lang.String issuer)Sets an alternative Issuer for this account.- Parameters:
issuer- The new IDP name.
-
getDisplayAccountName
public java.lang.String getDisplayAccountName()
Returns the name of this account. Returns originalaccountNameifdisplayAccountNameis not set.- Returns:
- The account name.
-
setDisplayAccountName
public void setDisplayAccountName(@NonNull java.lang.String accountName)Sets an alternative name for the account.- Parameters:
accountName- The new account name.
-
getAccountName
public java.lang.String getAccountName()
Returns the name of this account.- Returns:
- The account name.
-
getImageURL
public java.lang.String getImageURL()
Gets the image URL for the IDP that issued this account.- Returns:
- String representing the path to the image, or null if not assigned.
-
getBackgroundColor
public java.lang.String getBackgroundColor()
Gets the background color for the IDP that issued this account.- Returns:
- A hex string including a prepending # symbol, representing the color (e.g. #aabbcc)
-
getTimeAdded
public java.util.Calendar getTimeAdded()
Get the Date and Time this Account was stored.- Returns:
- when this account was stored.
-
getMechanisms
public java.util.List<Mechanism> getMechanisms()
Get the list of mechanisms associates with this account.- Returns:
- List
list of mechanisms
-
toJson
public java.lang.String toJson()
Creates a JSON string representation ofModelObjectobject. Sensitive information are not exposed.- Returns:
- a JSON string object
-
deserialize
public static Account deserialize(java.lang.String jsonString)
Deserializes the specified Json into an object of theAccountobject.- Parameters:
jsonString- the json string representing the object to be deserialized- Returns:
- an
Accountobject from the string. ReturnsnullifjsonStringisnull, ifjsonStringis empty or not able to parse it.
-
matches
public boolean matches(Account other)
Returns true if the two objects would conflict if added to a storage system.- Parameters:
other- The object to compare.- Returns:
- True if key traits of the objects match, false otherwise.
-
compareTo
public int compareTo(Account another)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-