public class LDUser
extends java.lang.Object
LDUser
object contains specific attributes of a user browsing your site. The only mandatory property property is the key
,
which must uniquely identify each user. For authenticated users, this may be a username or e-mail address. For anonymous users,
this could be an IP address or session ID.
Besides the mandatory key
, LDUser
supports two kinds of optional attributes: interpreted attributes (e.g. ip
and country
)
and custom attributes. LaunchDarkly can parse interpreted attributes and attach meaning to them. For example, from an ip
address, LaunchDarkly can
do a geo IP lookup and determine the user's country.
Custom attributes are not parsed by LaunchDarkly. They can be used in custom rules-- for example, a custom attribute such as "customer_ranking" can be used to launch a feature to the top 10% of users on a site.
If you want to pass an LDUser object to the front end to be used with the JavaScript SDK, simply call Gson.toJson()
or
Gson.toJsonTree()
on it.
Modifier and Type | Class and Description |
---|---|
static class |
LDUser.Builder
|
Modifier | Constructor and Description |
---|---|
protected |
LDUser(LDUser.Builder builder) |
|
LDUser(java.lang.String key)
Create a user with the given key
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
protected LDValue |
getValueForEvaluation(java.lang.String attribute) |
int |
hashCode() |
protected LDUser(LDUser.Builder builder)
public LDUser(java.lang.String key)
key
- a String
that uniquely identifies a userprotected LDValue getValueForEvaluation(java.lang.String attribute)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object