Class Profile
- java.lang.Object
-
- com.cheetahdigital.corekit.models.BaseModel
-
- com.cheetahdigital.profile.core.model.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
-
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 keyboolean
getAsBoolean(java.lang.String key)
Returns the boolean value of the member attribute for the keyjava.util.Date
getAsDate(java.lang.String key)
Returns the Date value of the member attribute for the keydouble
getAsDouble(java.lang.String key)
Returns the double value of the member attribute for the keyint
getAsInt(java.lang.String key)
Returns the int value of the member attribute for the keyjava.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 thetoString()
method of the objectjava.util.List<Metadata>
getMetadata()
Returns the list ofMetadata
associated to profilejava.lang.String
getValue(ProfileFieldView view)
Returns the value of the profile attribute based on theProfileFieldView.getFieldName()
void
put(java.lang.String key, java.lang.Object object)
Puts the object mapped to the keyvoid
set(ProfileFieldView view)
Sets the value of the profile attribute based on theProfileFieldView.getFieldName()
void
set(java.lang.String key, java.lang.Object value)
Sets the value of the profile attribute based on the keyvoid
setMetadata(java.util.List<Metadata> metadata)
Sets the metadata of the profile-
Methods inherited from class com.cheetahdigital.corekit.models.BaseModel
getData, getMessage, isSuccess, setData, setMessage, setSuccess
-
-
-
-
Field Detail
-
GMT
public static final java.lang.String GMT
- See Also:
- Constant Field Values
-
VIEW
public static final java.lang.String VIEW
- See Also:
- Constant Field Values
-
EDIT
public static final java.lang.String EDIT
- See Also:
- Constant Field Values
-
VIEW_EDIT
public static final java.lang.String VIEW_EDIT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Profile
public Profile(java.util.List<Metadata> metadata)
Public constructor for Profile- Parameters:
metadata
-List
ofMetadata
from the API call to api/describeProfileAPI.getProfileMetadata(ProfileParams, boolean, Listener)
-
-
Method Detail
-
getMetadata
public java.util.List<Metadata> getMetadata()
Returns the list ofMetadata
associated to profile- Returns:
- the
List
ofMetadata
for this environment
-
setMetadata
public void setMetadata(java.util.List<Metadata> metadata)
Sets the metadata of the profile- Parameters:
metadata
- list ofMetadata
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 typeMetadata.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 typeMetadata.DATE
orMetadata.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 typeMetadata.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 typeMetadata.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 thetoString()
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(@NonNull ProfileFieldView view)
Sets the value of the profile attribute based on theProfileFieldView.getFieldName()
- Parameters:
view
-ProfileFieldView
-
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 namevalue
- value of the object
-
getValue
public java.lang.String getValue(@NonNull ProfileFieldView view)
Returns the value of the profile attribute based on theProfileFieldView.getFieldName()
- Parameters:
view
-ProfileFieldView
- Returns:
- String value of the attribute
-
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
-
-