001package com.box.sdk;
002
003import com.eclipsesource.json.JsonObject;
004import com.eclipsesource.json.JsonValue;
005
006/**
007 * Represents a Box user's email alias.
008 */
009public class EmailAlias extends BoxJSONObject {
010    private String id;
011    private boolean isConfirmed;
012    private String email;
013
014    /**
015     * Constructs an empty EmailAlias.
016     */
017    public EmailAlias() { }
018
019    /**
020     * Constructs an EmailAlias from a JSON string.
021     * @param  json the json encoded email alias.
022     */
023    public EmailAlias(String json) {
024        super(json);
025    }
026
027    EmailAlias(JsonObject jsonObject) {
028        super(jsonObject);
029    }
030
031    /**
032     * Gets the ID of this email alias.
033     * @return the ID of this email alias.
034     */
035    public String getID() {
036        return this.id;
037    }
038
039    /**
040     * Gets whether or not the user has confirmed this email alias.
041     * @return true if the user has confirmed this email alias; otherwise false.
042     */
043    public boolean getIsConfirmed() {
044        return this.isConfirmed;
045    }
046
047    /**
048     * Gets the email address of this email alias.
049     * @return the email address of this email alias.
050     */
051    public String getEmail() {
052        return this.email;
053    }
054
055    @Override
056    void parseJSONMember(JsonObject.Member member) {
057        JsonValue value = member.getValue();
058        String memberName = member.getName();
059        if (memberName.equals("id")) {
060            this.id = value.asString();
061        } else if (memberName.equals("is_confirmed")) {
062            this.isConfirmed = value.asBoolean();
063        } else if (memberName.equals("email")) {
064            this.email = value.asString();
065        }
066    }
067}