Package com.batch.android
Class BatchUserDataEditor
- java.lang.Object
-
- com.batch.android.BatchUserDataEditor
-
public class BatchUserDataEditor extends java.lang.ObjectBatch User data editor
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTAG
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchUserDataEditoraddTag(java.lang.String collection, java.lang.String tag)Add a tag in the specified collection.BatchUserDataEditorclearAttributes()Removes all attributes.BatchUserDataEditorclearTagCollection(java.lang.String collection)Removes all tags from a collection.BatchUserDataEditorclearTags()Removes all tags.BatchUserDataEditorremoveAttribute(java.lang.String key)Removes a custom attribute.
Does nothing if it was not set.BatchUserDataEditorremoveTag(java.lang.String collection, java.lang.String tag)Removes a tag from a collection.voidsave()Save all of the pending changes made in that editor.BatchUserDataEditorsetAttribute(java.lang.String key, boolean value)Set a custom user attribute for a key.BatchUserDataEditorsetAttribute(java.lang.String key, double value)Set a custom user attribute for a key.BatchUserDataEditorsetAttribute(java.lang.String key, long value)Set a custom user attribute for a key.BatchUserDataEditorsetAttribute(java.lang.String key, java.lang.String value)Set a custom user attribute for a key.BatchUserDataEditorsetAttribute(java.lang.String key, java.net.URI value)Set a custom user attribute for a key.BatchUserDataEditorsetAttribute(java.lang.String key, java.util.Date value)Set a custom user attribute for a key.BatchUserDataEditorsetIdentifier(java.lang.String identifier)Set the user identifier.
Be careful: you should make sure the identifier uniquely identifies a user.BatchUserDataEditorsetLanguage(java.lang.String language)Set the language of this user.
Overrides the detected user language.BatchUserDataEditorsetRegion(java.lang.String region)Set the region of this user.
Overrides the detected user region.
-
-
-
Field Detail
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
setLanguage
public BatchUserDataEditor setLanguage(@Nullable java.lang.String language)
Set the language of this user.
Overrides the detected user language.- Parameters:
language- lowercase, ISO 639 formatted string. null to reset.- Returns:
- This object instance, for method chaining
-
setRegion
public BatchUserDataEditor setRegion(@Nullable java.lang.String region)
Set the region of this user.
Overrides the detected user region.- Parameters:
region- uppercase, ISO 3166 formatted string. null to reset.- Returns:
- This object instance, for method chaining
-
setIdentifier
public BatchUserDataEditor setIdentifier(@Nullable java.lang.String identifier)
Set the user identifier.
Be careful: you should make sure the identifier uniquely identifies a user. When pushing an identifier, all installations with that identifier will get the Push, which can cause some privacy issues if done wrong.- Parameters:
identifier- Identifier string- Returns:
- This object instance, for method chaining
-
setAttribute
public BatchUserDataEditor setAttribute(@NonNull java.lang.String key, long value)
Set a custom user attribute for a key.- Parameters:
key- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
public BatchUserDataEditor setAttribute(@NonNull java.lang.String key, double value)
Set a custom user attribute for a key.- Parameters:
key- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
public BatchUserDataEditor setAttribute(@NonNull java.lang.String key, boolean value)
Set a custom user attribute for a key.- Parameters:
key- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
public BatchUserDataEditor setAttribute(@NonNull java.lang.String key, @NonNull java.util.Date value)
Set a custom user attribute for a key.- Parameters:
key- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value- Attribute value, can't be null. Note that since timezones are not supported, this will typically represent UTC dates.- Returns:
- This object instance, for method chaining
-
setAttribute
public BatchUserDataEditor setAttribute(@NonNull java.lang.String key, @NonNull java.lang.String value)
Set a custom user attribute for a key.- Parameters:
key- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value- Attribute value, can't be null or empty. Must be a string not longer than 64 characters. For better results, you should make them upper/lowercase and trim the whitespaces.- Returns:
- This object instance, for method chaining
-
setAttribute
public BatchUserDataEditor setAttribute(@NonNull java.lang.String key, @NonNull java.net.URI value)
Set a custom user attribute for a key.- Parameters:
key- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value- Attribute value, can't be null or empty. Must be a valid URI not longer than 2048 character.- Returns:
- This object instance, for method chaining
-
removeAttribute
public BatchUserDataEditor removeAttribute(@NonNull java.lang.String key)
Removes a custom attribute.
Does nothing if it was not set.- Parameters:
key- Attribute key- Returns:
- This object instance, for method chaining
-
clearAttributes
public BatchUserDataEditor clearAttributes()
Removes all attributes.- Returns:
- This object instance, for method chaining
-
addTag
public BatchUserDataEditor addTag(@NonNull java.lang.String collection, @NonNull java.lang.String tag)
Add a tag in the specified collection. If empty, the collection will automatically be created.- Parameters:
collection- The collection to add the tag to. Cannot be null. Must be a string of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.tag- The tag to add. Cannot be null or empty. Must be a string no longer than 64 characters.- Returns:
- This object instance, for method chaining
-
removeTag
public BatchUserDataEditor removeTag(@NonNull java.lang.String collection, @NonNull java.lang.String tag)
Removes a tag from a collection. Does nothing if the tag does not exist.- Parameters:
collection- Collection nametag- Tag name- Returns:
- This object instance, for method chaining
-
clearTags
public BatchUserDataEditor clearTags()
Removes all tags.- Returns:
- This object instance, for method chaining
-
clearTagCollection
public BatchUserDataEditor clearTagCollection(@NonNull java.lang.String collection)
Removes all tags from a collection. Does nothing if the tag collection does not exist.- Parameters:
collection- Tag collection.- Returns:
- This object instance, for method chaining
-
save
public void save()
Save all of the pending changes made in that editor. Note that this call may fail if Batch isn't started. In that case, your changes will be lost. Once you called "save", you need to get a new editor in order to make further changes.This action cannot be undone.
-
-