Class ProfileV1


  • public class ProfileV1
    extends java.lang.Object

    Package Starting Point - This class is responsible for holding and persisting user profile information.



    • Constructor Summary

      Constructors 
      Constructor Description
      ProfileV1()
      Constructs an empty profile object
      ProfileV1​(JSONObject json)
      Constructs a Profile instance with a given JSONObject
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getFirstName()
      Gets the first name of the user
      java.lang.String getGender()
      Gets the gender types, such as female, male or unknown
      java.lang.String getLastName()
      Gets the last name of the user
      java.lang.String getMiddleName()
      Gets the middle name of the user
      java.lang.String getPrefix()
      Gets the prefix of the user, such as Mr, Mrs or Ms
      java.lang.String getSuffix()
      Gets the suffix of the user, such as III, Sr or MD
      boolean restoreFromDisk​(Context appContext)
      restore list from disk that was previously
      void saveToDisk​(Context appContext)
      Saves the user preferences to disk so that it maybe restored later.
      void setFirstName​(java.lang.String firstName)
      Sets the first name of the user
      void setGender​(java.lang.String gender)
      Sets the gender types, such as female, male or unknown
      void setLastName​(java.lang.String lastName)
      Sets the last name of the user
      void setMiddleName​(java.lang.String middleName)
      Sets the middle name of the user
      void setPrefix​(java.lang.String prefix)
      Sets the prefix of the user, such as Mr, Mrs or Ms
      void setSuffix​(java.lang.String suffix)
      Sets the suffix of the user, such as III, Sr or MD
      JSONObject toJson()
      Exports the user's profile to a JSON format, which can be used to update the user profile on the seatback monitor.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProfileV1

        public ProfileV1()
        Constructs an empty profile object
      • ProfileV1

        public ProfileV1​(JSONObject json)
        Constructs a Profile instance with a given JSONObject
        Parameters:
        json - JSONObject to create profile from
    • Method Detail

      • toJson

        public JSONObject toJson()
        Exports the user's profile to a JSON format, which can be used to update the user profile on the seatback monitor.
        Returns:
        JSONObject containing Profile data
      • getFirstName

        public java.lang.String getFirstName()
        Gets the first name of the user
        Returns:
        java.lang.String
      • setFirstName

        public void setFirstName​(java.lang.String firstName)
        Sets the first name of the user
        Parameters:
        firstName - java.lang.String the firstName to set
      • getLastName

        public java.lang.String getLastName()
        Gets the last name of the user
        Returns:
        java.lang.String
      • setLastName

        public void setLastName​(java.lang.String lastName)
        Sets the last name of the user
        Parameters:
        lastName - java.lang.String the LastName to set
      • getMiddleName

        public java.lang.String getMiddleName()
        Gets the middle name of the user
        Returns:
        java.lang.String
      • setMiddleName

        public void setMiddleName​(java.lang.String middleName)
        Sets the middle name of the user
        Parameters:
        middleName - java.lang.String the middleName to set
      • getSuffix

        public java.lang.String getSuffix()
        Gets the suffix of the user, such as III, Sr or MD
        Returns:
        java.lang.String
      • setSuffix

        public void setSuffix​(java.lang.String suffix)
        Sets the suffix of the user, such as III, Sr or MD
        Parameters:
        suffix - java.lang.String the suffix to set
      • getPrefix

        public java.lang.String getPrefix()
        Gets the prefix of the user, such as Mr, Mrs or Ms
        Returns:
        java.lang.String
      • setPrefix

        public void setPrefix​(java.lang.String prefix)
        Sets the prefix of the user, such as Mr, Mrs or Ms
        Parameters:
        prefix - java.lang.String the prefix to set
      • getGender

        public java.lang.String getGender()
        Gets the gender types, such as female, male or unknown
        Returns:
        java.lang.String
      • setGender

        public void setGender​(java.lang.String gender)
        Sets the gender types, such as female, male or unknown
        Parameters:
        gender - java.lang.String the gender to set
      • saveToDisk

        public void saveToDisk​(Context appContext)
        Saves the user preferences to disk so that it maybe restored later.
      • restoreFromDisk

        public boolean restoreFromDisk​(Context appContext)
        restore list from disk that was previously
        Parameters:
        appContext -
        Returns:
        true if file was found and restored succesfully