// Copyright (c) 2011, Chute Corporation. All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of the Chute Corporation nor the names // of its contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. // package com.chute.sdk.v2.model; import android.os.Parcel; import android.os.Parcelable; import com.fasterxml.jackson.annotation.JsonProperty; /** * The {@link ProfileModel} class holds information regarding the user profile. */ public class ProfileModel implements Parcelable { /** * First name of the user. */ @JsonProperty("first_name") private String firstName; /** * Last name of the user. */ @JsonProperty("last_name") private String lastName; /** * User e-mail. */ @JsonProperty("email") private String email; /** * User phone number. */ @JsonProperty("phone_number") private String phoneNumber; /** * User birth year. */ @JsonProperty("birth_year") private String birthYear; /** * Getter and setter methods. */ public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getBirthYear() { return birthYear; } public void setBirthYear(String birthYear) { this.birthYear = birthYear; } /** * Default non-args constructor. */ public ProfileModel() { } public ProfileModel(Parcel in) { this(); firstName = in.readString(); lastName = in.readString(); email = in.readString(); phoneNumber = in.readString(); birthYear = in.readString(); } /* * (non-Javadoc) * * @see android.os.Parcelable#describeContents() */ @Override public int describeContents() { return 0; } /* * (non-Javadoc) * * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int) */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(firstName); dest.writeString(lastName); dest.writeString(email); dest.writeString(phoneNumber); dest.writeString(birthYear); } public static final Creator<ProfileModel> CREATOR = new Creator<ProfileModel>() { @Override public ProfileModel createFromParcel(Parcel in) { return new ProfileModel(in); } @Override public ProfileModel[] newArray(int size) { return new ProfileModel[size]; } }; @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProfileModel that = (ProfileModel) o; if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return false; if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) return false; if (email != null ? !email.equals(that.email) : that.email != null) return false; if (phoneNumber != null ? !phoneNumber.equals(that.phoneNumber) : that.phoneNumber != null) return false; return !(birthYear != null ? !birthYear.equals(that.birthYear) : that.birthYear != null); } @Override public int hashCode() { int result = firstName != null ? firstName.hashCode() : 0; result = 31 * result + (lastName != null ? lastName.hashCode() : 0); result = 31 * result + (email != null ? email.hashCode() : 0); result = 31 * result + (phoneNumber != null ? phoneNumber.hashCode() : 0); result = 31 * result + (birthYear != null ? birthYear.hashCode() : 0); return result; } @Override public String toString() { final StringBuilder sb = new StringBuilder("ProfileModel{"); sb.append("firstName='").append(firstName).append('\''); sb.append(", lastName='").append(lastName).append('\''); sb.append(", email='").append(email).append('\''); sb.append(", phoneNumber='").append(phoneNumber).append('\''); sb.append(", birthYear='").append(birthYear).append('\''); sb.append('}'); return sb.toString(); } }