Package com.kii.cloud.storage
Class UserFields
- java.lang.Object
-
- com.kii.cloud.storage.KiiBaseObject
-
- com.kii.cloud.storage.UserFields
-
public class UserFields extends KiiBaseObject
-
-
Field Summary
-
Fields inherited from class com.kii.cloud.storage.KiiBaseObject
mJSON, mJSONPatch
-
-
Constructor Summary
Constructors Constructor Description UserFields()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isEmpty()
Checks whether the current UserFields is empty.void
putCountry(java.lang.String country)
Specify new country code.void
putDisplayName(java.lang.String displayName)
Specify new display name.void
putLocale(LocaleContainer locale)
Specify new locale(BCP47).void
remove(java.lang.String key)
Remove a pair of key/value from KiiBaseObjectvoid
removeCountry()
Remove country.void
removeDisplayName()
Remove display name.void
removeFromServer(java.lang.String key)
Remove a pair of key/value from UserFields.void
removeLocale()
Remove locale.void
set(java.lang.String key, byte[] value)
Create/Update the key/value byte array in the KiiBaseObjectvoid
set(java.lang.String key, double value)
Create/Update association of the specified key with the specified double value in the KiiObject.void
set(java.lang.String key, int value)
Create/Update the key/value int in the KiiBaseObjectvoid
set(java.lang.String key, long value)
Create/Update the key/value long in the KiiBaseObjectvoid
set(java.lang.String key, android.net.Uri value)
Create/Update the key/value Uri in the KiiBaseObjectvoid
set(java.lang.String key, java.lang.Boolean value)
Create/Update the key/value boolean in the KiiBaseObjectvoid
set(java.lang.String key, java.lang.String value)
Create/Update the key/value string in the KiiBaseObjectvoid
set(java.lang.String key, org.json.JSONArray value)
Create/Update association of the specified key with the specified JSONArray value in the KiiObject.void
set(java.lang.String key, org.json.JSONObject value)
Create/Update the key/value JSONObject in the KiiBaseObjectjava.lang.String
toString()
-
Methods inherited from class com.kii.cloud.storage.KiiBaseObject
getBoolean, getBoolean, getByteArray, getDouble, getDouble, getInt, getInt, getJsonArray, getJSONArray, getJSONObject, getJSONOfArbitraryFields, getLong, getLong, getObject, getObject, getString, getString, getUri, has, keySet, removeReserveProperty
-
-
-
-
Method Detail
-
putDisplayName
public void putDisplayName(@NonNull java.lang.String displayName)
Specify new display name.- Parameters:
displayName
-- Throws:
java.lang.IllegalArgumentException
- ifKiiUser.isValidDisplayName(String)
returns false for this displayName.
-
putCountry
public void putCountry(@NonNull java.lang.String country)
Specify new country code.- Parameters:
country
-- Throws:
java.lang.IllegalArgumentException
- ifKiiUser.isValidCountry(String)
returns false for this country.
-
putLocale
public void putLocale(@NonNull LocaleContainer locale)
Specify new locale(BCP47).- Parameters:
locale
-- Throws:
java.lang.IllegalArgumentException
- if locale is null
-
removeDisplayName
public void removeDisplayName()
Remove display name. This method removes display name which is put byputDisplayName(String)
. Even if you use this method, display name is not removed from server.
-
removeCountry
public void removeCountry()
Remove country. This method removes country which is put byputCountry(String)
. Even if you use this method, country is not removed from server.
-
removeLocale
public void removeLocale()
Remove locale. This method removes locale which is put byputLocale(LocaleContainer)
. Even if you use this method, locale is not removed from server.
-
removeFromServer
public void removeFromServer(java.lang.String key) throws java.lang.IllegalArgumentException
Remove a pair of key/value from UserFields. This pair is also removed from server whenKiiUser.update(IdentityData, UserFields)
orKiiUser.update(IdentityData, UserFields, KiiUserUpdateCallback)
is succeeded.NOTE:
UserFields
has a similar method which isKiiBaseObject.remove(String)
. If you remove fields byKiiBaseObject.remove(String)
, pairs are not removed from server. So you can useKiiBaseObject.remove(String)
if you want to cancel to update fields which are set inUserFields
.- Parameters:
key
- to remove.- Throws:
java.lang.IllegalArgumentException
- when key is reserve fields defined inKiiUser
.
-
toString
@Nullable public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
set
public void set(java.lang.String key, int value)
Description copied from class:KiiBaseObject
Create/Update the key/value int in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- is Value int
-
set
public void set(java.lang.String key, long value)
Description copied from class:KiiBaseObject
Create/Update the key/value long in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- is Value long
-
set
public void set(java.lang.String key, byte[] value)
Description copied from class:KiiBaseObject
Create/Update the key/value byte array in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- in byte array
-
set
public void set(java.lang.String key, java.lang.String value)
Description copied from class:KiiBaseObject
Create/Update the key/value string in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- is Value string
-
set
public void set(java.lang.String key, java.lang.Boolean value)
Description copied from class:KiiBaseObject
Create/Update the key/value boolean in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- is Value boolean
-
set
public void set(java.lang.String key, double value)
Description copied from class:KiiBaseObject
Create/Update association of the specified key with the specified double value in the KiiObject.
NOTE: Before involving floating point value, please consider using integer(int/long) instead. For example, use percentage, permil, ppm, etc. The reason is:- Will dramatically improve the performance of bucket query.
- Bucket query does not support the mixed result of integer and floating point. ex.) If you use same key for integer and floating point and inquire object with the integer value, objects which has double value with the key would not be evaluated in the query. (and vice versa)
- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- Key string.value
- double value.
-
set
public void set(java.lang.String key, org.json.JSONArray value)
Description copied from class:KiiBaseObject
Create/Update association of the specified key with the specified JSONArray value in the KiiObject.- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- Key string.value
- JSONArray value.
-
set
public void set(java.lang.String key, android.net.Uri value)
Description copied from class:KiiBaseObject
Create/Update the key/value Uri in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- is Uri
-
set
public void set(java.lang.String key, org.json.JSONObject value)
Description copied from class:KiiBaseObject
Create/Update the key/value JSONObject in the KiiBaseObject- Overrides:
set
in classKiiBaseObject
- Parameters:
key
- is Key stringvalue
- is JSONObject
-
remove
public void remove(java.lang.String key)
Description copied from class:KiiBaseObject
Remove a pair of key/value from KiiBaseObject- Overrides:
remove
in classKiiBaseObject
- Parameters:
key
- to remove.
-
isEmpty
public boolean isEmpty()
Checks whether the current UserFields is empty.- Returns:
- true if empty, false otherwise.
-
-