Package com.launchdarkly.sdk
Class UserAttribute
java.lang.Object
com.launchdarkly.sdk.UserAttribute
- All Implemented Interfaces:
JsonSerializable
public final class UserAttribute extends java.lang.Object implements JsonSerializable
Represents a built-in or custom attribute name supported by
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.
-
Field Summary
Fields Modifier and Type Field Description static UserAttributeANONYMOUSRepresents the anonymous attribute.static UserAttributeAVATARRepresents the avatar URL attribute.static UserAttributeCOUNTRYRepresents the country attribute.static UserAttributeEMAILRepresents the user key attribute.static UserAttributeFIRST_NAMERepresents the first name attribute.static UserAttributeIPRepresents the IP address attribute.static UserAttributeKEYRepresents the user key attribute.static UserAttributeLAST_NAMERepresents the last name attribute.static UserAttributeNAMERepresents the full name attribute.static UserAttributeSECONDARY_KEYRepresents the secondary key attribute. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object other)static UserAttributeforName(java.lang.String name)Returns a UserAttribute instance for the specified attribute name.java.lang.StringgetName()Returns the case-sensitive attribute name.inthashCode()booleanisBuiltIn()Returns true for a built-in attribute or false for a custom attribute.java.lang.StringtoString()
-
Field Details
-
KEY
Represents the user key attribute. -
SECONDARY_KEY
Represents the secondary key attribute. -
IP
Represents the IP address attribute. -
EMAIL
Represents the user key attribute. -
NAME
Represents the full name attribute. -
AVATAR
Represents the avatar URL attribute. -
FIRST_NAME
Represents the first name attribute. -
LAST_NAME
Represents the last name attribute. -
COUNTRY
Represents the country attribute. -
ANONYMOUS
Represents the anonymous attribute.
-
-
Method Details
-
forName
Returns a UserAttribute instance for the specified attribute name.For built-in attributes, the same instances are always reused and
isBuiltIn()will return true. For custom attributes, a new instance is created andisBuiltIn()will return false.- Parameters:
name- the attribute name- Returns:
- a
UserAttribute
-
getName
public java.lang.String getName()Returns the case-sensitive attribute name.- Returns:
- the attribute name
-
isBuiltIn
public boolean isBuiltIn()Returns true for a built-in attribute or false for a custom attribute.- Returns:
- true if it is a built-in attribute
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-