public final class UserAttribute extends java.lang.Object implements JsonSerializable
LDUser
.
This abstraction helps to distinguish attribute names from other String
values, and also
improves efficiency in feature flag data structures and evaluations because built-in attributes
always reuse the same instances.
For a fuller description of user attributes and how they can be referenced in feature flag rules, see the reference guides on Setting user attributes and Targeting users.
Modifier and Type | Field and Description |
---|---|
static UserAttribute |
ANONYMOUS
Represents the anonymous attribute.
|
static UserAttribute |
AVATAR
Represents the avatar URL attribute.
|
static UserAttribute |
COUNTRY
Represents the country attribute.
|
static UserAttribute |
EMAIL
Represents the user key attribute.
|
static UserAttribute |
FIRST_NAME
Represents the first name attribute.
|
static UserAttribute |
IP
Represents the IP address attribute.
|
static UserAttribute |
KEY
Represents the user key attribute.
|
static UserAttribute |
LAST_NAME
Represents the last name attribute.
|
static UserAttribute |
NAME
Represents the full name attribute.
|
static UserAttribute |
SECONDARY_KEY
Represents the secondary key attribute.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
static UserAttribute |
forName(java.lang.String name)
Returns a UserAttribute instance for the specified attribute name.
|
java.lang.String |
getName()
Returns the case-sensitive attribute name.
|
int |
hashCode() |
boolean |
isBuiltIn()
Returns true for a built-in attribute or false for a custom attribute.
|
java.lang.String |
toString() |
public static final UserAttribute KEY
public static final UserAttribute SECONDARY_KEY
public static final UserAttribute IP
public static final UserAttribute EMAIL
public static final UserAttribute NAME
public static final UserAttribute AVATAR
public static final UserAttribute FIRST_NAME
public static final UserAttribute LAST_NAME
public static final UserAttribute COUNTRY
public static final UserAttribute ANONYMOUS
public static UserAttribute forName(java.lang.String name)
For built-in attributes, the same instances are always reused and isBuiltIn()
will
return true. For custom attributes, a new instance is created and isBuiltIn()
will
return false.
name
- the attribute nameUserAttribute
public java.lang.String getName()
public boolean isBuiltIn()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object