Class Profile


  • public class Profile
    extends BaseModel
    Cheetah Loyalty - Profile
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Profile.ModeType
      Annotation for different Mode Types
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EDIT  
      static java.lang.String GMT  
      static java.lang.String VIEW  
      static java.lang.String VIEW_EDIT  
    • Constructor Summary

      Constructors 
      Constructor Description
      Profile​(java.util.List<Metadata> metadata)
      Public constructor for Profile
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(java.lang.String key)
      Returns the object paired with the key
      boolean getAsBoolean​(java.lang.String key)
      Returns the boolean value of the member attribute for the key
      java.util.Date getAsDate​(java.lang.String key)
      Returns the Date value of the member attribute for the key
      double getAsDouble​(java.lang.String key)
      Returns the double value of the member attribute for the key
      int getAsInt​(java.lang.String key)
      Returns the int value of the member attribute for the key
      java.lang.String getAsString​(java.lang.String key)
      Returns the String value of the member attribute for the key Forces the value to be a string by calling the toString() method of the object
      java.util.List<Metadata> getMetadata()
      Returns the list of Metadata associated to profile
      java.lang.String getValue​(ProfileFieldView view)
      Returns the value of the profile attribute based on the ProfileFieldView.getFieldName()
      void put​(java.lang.String key, java.lang.Object object)
      Puts the object mapped to the key
      void set​(ProfileFieldView view)
      Sets the value of the profile attribute based on the ProfileFieldView.getFieldName()
      void set​(java.lang.String key, java.lang.Object value)
      Sets the value of the profile attribute based on the key
      void setMetadata​(java.util.List<Metadata> metadata)
      Sets the metadata of the profile
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getMetadata

        public java.util.List<Metadata> getMetadata()
        Returns the list of Metadata associated to profile
        Returns:
        the List of Metadata for this environment
      • setMetadata

        public void setMetadata​(java.util.List<Metadata> metadata)
        Sets the metadata of the profile
        Parameters:
        metadata - list of Metadata for current profile
      • getAsBoolean

        public boolean getAsBoolean​(java.lang.String key)
                             throws java.lang.ClassCastException
        Returns the boolean value of the member attribute for the key
        Parameters:
        key - name of the member attribute, must match name in metadata
        Returns:
        the value of the member attribute with key
        Throws:
        java.lang.ClassCastException - if the key is not of type Metadata.BOOLEAN
      • getAsDate

        public java.util.Date getAsDate​(java.lang.String key)
                                 throws java.lang.ClassCastException
        Returns the Date value of the member attribute for the key
        Parameters:
        key - name of the member attribute, must match name in metadata
        Returns:
        the Date value of the member attribute with key
        Throws:
        java.lang.ClassCastException - if the key is not of type Metadata.DATE or Metadata.DATETIME
      • getAsDouble

        public double getAsDouble​(java.lang.String key)
                           throws java.lang.ClassCastException
        Returns the double value of the member attribute for the key
        Parameters:
        key - name of the member attribute, must match the name in metadata
        Returns:
        the double value of the member attribute with key
        Throws:
        java.lang.ClassCastException - if the key is not of type Metadata.DECIMAL
      • getAsInt

        public int getAsInt​(java.lang.String key)
                     throws java.lang.ClassCastException
        Returns the int value of the member attribute for the key
        Parameters:
        key - name of the member attribute, must match the name in metadata
        Returns:
        the int value of the member attribute with key
        Throws:
        java.lang.ClassCastException - if the key is not of type Metadata.INTEGER
      • getAsString

        public java.lang.String getAsString​(java.lang.String key)
        Returns the String value of the member attribute for the key Forces the value to be a string by calling the toString() method of the object
        Parameters:
        key - name of the member attribute, must match the name in metadata
        Returns:
        value if not empty or null else empty string
      • set

        public void set​(java.lang.String key,
                        java.lang.Object value)
        Sets the value of the profile attribute based on the key
        Parameters:
        key - metadata name
        value - value of the object
      • get

        public java.lang.Object get​(java.lang.String key)
        Returns the object paired with the key
        Parameters:
        key - key/name of the member attribute
        Returns:
        the member attribute value
      • put

        public void put​(java.lang.String key,
                        java.lang.Object object)
        Puts the object mapped to the key
        Parameters:
        key - key of the member attribute (e.g. first_name for First Name)
        object - value of the member attribute