Class UserAttribute

  • All Implemented Interfaces:

    public final class UserAttribute
    extends java.lang.Object
    implements JsonSerializable
    Represents a built-in or custom attribute name supported by LDUser.

    Application code rarely needs to use this type; it is used internally by the SDK for efficiency in flag evaluations. It can also be used as a reference for the constant names of built-in attributes such as EMAIL. However, in the newer LDContext model, there are very few reserved attribute names, so the equivalent of EMAIL would simply be a custom attribute called "email".

    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 Detail

      • KEY

        public static final UserAttribute KEY
        Represents the user key attribute.
      • IP

        public static final UserAttribute IP
        Represents the IP address attribute.
      • EMAIL

        public static final UserAttribute EMAIL
        Represents the user key attribute.
      • NAME

        public static final UserAttribute NAME
        Represents the full name attribute.
      • AVATAR

        public static final UserAttribute AVATAR
        Represents the avatar URL attribute.
      • FIRST_NAME

        public static final UserAttribute FIRST_NAME
        Represents the first name attribute.
      • LAST_NAME

        public static final UserAttribute LAST_NAME
        Represents the last name attribute.
      • COUNTRY

        public static final UserAttribute COUNTRY
        Represents the country attribute.

        public static final UserAttribute ANONYMOUS
        Represents the anonymous attribute.
    • Method Detail

      • forName

        public static UserAttribute forName​(java.lang.String name)
        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 and isBuiltIn() will return false.

        name - the attribute name
        a UserAttribute
      • getName

        public java.lang.String getName()
        Returns the case-sensitive attribute name.
        the attribute name
      • isBuiltIn

        public boolean isBuiltIn()
        Returns true for a built-in attribute or false for a custom attribute.
        true if it is a built-in attribute
      • equals

        public boolean equals​(java.lang.Object other)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object