Package com.mparticle.identity
Class MParticleUserImpl
- java.lang.Object
-
- com.mparticle.identity.MParticleUserImpl
-
- All Implemented Interfaces:
MParticleUser
public class MParticleUserImpl extends java.lang.Object implements MParticleUser
A class which represents a User.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MParticleUserImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConsentState
getConsentState()
Query the ConsentState of this userlong
getFirstSeenTime()
The timestamp representing the first time this user was observed on this devicelong
getId()
query the MPID of the Userlong
getLastSeenTime()
The timestamp representing the last time this user was the "currentUser" on this devicevoid
getSegments(long timeout, java.lang.String endpointId, SegmentListener listener)
java.util.Map<java.lang.String,java.lang.Object>
getUserAttributes()
query the attributes of the Userjava.util.Map<java.lang.String,java.lang.Object>
getUserAttributes(UserAttributeListener listener)
Query the attributes of the User asynchronously.java.util.Map<MParticle.IdentityType,java.lang.String>
getUserIdentities()
query the Identities of the Userboolean
incrementUserAttribute(java.lang.String key, int value)
increment an attribute for the userboolean
isLoggedIn()
Query the "Logged In" status for this user.boolean
removeUserAttribute(java.lang.String key)
remove an attribute for the uservoid
setConsentState(ConsentState state)
Set the ConsentState for this userboolean
setUserAttribute(java.lang.String key, java.lang.Object value)
set a single attribute for the userboolean
setUserAttributeList(java.lang.String key, java.lang.Object value)
set a single attribute for the user whose value is an Object, not just a Stringboolean
setUserAttributes(java.util.Map<java.lang.String,java.lang.Object> userAttributes)
assign attributes to the User in bulkboolean
setUserTag(java.lang.String tag)
set a tag for a User.
-
-
-
Method Detail
-
getId
public long getId()
Description copied from interface:MParticleUser
query the MPID of the User- Specified by:
getId
in interfaceMParticleUser
- Returns:
- the mpid
-
getUserAttributes
public java.util.Map<java.lang.String,java.lang.Object> getUserAttributes()
Description copied from interface:MParticleUser
query the attributes of the User- Specified by:
getUserAttributes
in interfaceMParticleUser
- Returns:
- the User's attributes
-
getUserAttributes
public java.util.Map<java.lang.String,java.lang.Object> getUserAttributes(UserAttributeListener listener)
Query the attributes of the User asynchronously.- Specified by:
getUserAttributes
in interfaceMParticleUser
- Parameters:
listener
- a callback for querying User's attributes- Returns:
-
setUserAttributes
public boolean setUserAttributes(java.util.Map<java.lang.String,java.lang.Object> userAttributes)
Description copied from interface:MParticleUser
assign attributes to the User in bulk- Specified by:
setUserAttributes
in interfaceMParticleUser
- Parameters:
userAttributes
- the attributes to be set- Returns:
- whether the attributes were successfully set
-
getUserIdentities
public java.util.Map<MParticle.IdentityType,java.lang.String> getUserIdentities()
Description copied from interface:MParticleUser
query the Identities of the User- Specified by:
getUserIdentities
in interfaceMParticleUser
- Returns:
- the User's Identities
-
setUserAttribute
public boolean setUserAttribute(java.lang.String key, java.lang.Object value)
Description copied from interface:MParticleUser
set a single attribute for the user- Specified by:
setUserAttribute
in interfaceMParticleUser
- Parameters:
key
- the key of the attributevalue
- the value of the attribute- Returns:
- whether the attributes were successfully set
-
setUserAttributeList
public boolean setUserAttributeList(java.lang.String key, java.lang.Object value)
Description copied from interface:MParticleUser
set a single attribute for the user whose value is an Object, not just a String- Specified by:
setUserAttributeList
in interfaceMParticleUser
- Parameters:
key
- the key of the attributevalue
- the value of the attribute- Returns:
- whether the attributes were successfully set
-
incrementUserAttribute
public boolean incrementUserAttribute(java.lang.String key, int value)
Description copied from interface:MParticleUser
increment an attribute for the user- Specified by:
incrementUserAttribute
in interfaceMParticleUser
- Parameters:
key
- the key of the attributevalue
- the value of the attribute- Returns:
- whether the attributes were successfully set
-
removeUserAttribute
public boolean removeUserAttribute(java.lang.String key)
Description copied from interface:MParticleUser
remove an attribute for the user- Specified by:
removeUserAttribute
in interfaceMParticleUser
- Parameters:
key
- the key of the attribute which is to be removed- Returns:
- whether the attributes were successfully removed
-
setUserTag
public boolean setUserTag(@NonNull java.lang.String tag)
Description copied from interface:MParticleUser
set a tag for a User. A tag is represented by a key and a value of "null"- Specified by:
setUserTag
in interfaceMParticleUser
- Parameters:
tag
- the tag to be set for the user- Returns:
- whether the tag was successfully set
-
getSegments
public void getSegments(long timeout, java.lang.String endpointId, SegmentListener listener)
-
getConsentState
public ConsentState getConsentState()
Description copied from interface:MParticleUser
Query the ConsentState of this user- Specified by:
getConsentState
in interfaceMParticleUser
-
setConsentState
public void setConsentState(ConsentState state)
Description copied from interface:MParticleUser
Set the ConsentState for this user- Specified by:
setConsentState
in interfaceMParticleUser
-
isLoggedIn
public boolean isLoggedIn()
Description copied from interface:MParticleUser
Query the "Logged In" status for this user. A user is considered Logged In based on the presence of one or moreMParticle.IdentityType
, such as IdentityType.CustomerId, defined by a workspace's IDSync strategy.- Specified by:
isLoggedIn
in interfaceMParticleUser
- Returns:
- whether the user is "Logged In"
-
getFirstSeenTime
public long getFirstSeenTime()
Description copied from interface:MParticleUser
The timestamp representing the first time this user was observed on this device- Specified by:
getFirstSeenTime
in interfaceMParticleUser
- Returns:
-
getLastSeenTime
public long getLastSeenTime()
Description copied from interface:MParticleUser
The timestamp representing the last time this user was the "currentUser" on this device- Specified by:
getLastSeenTime
in interfaceMParticleUser
- Returns:
- the time, in milliseconds
-
-