public static class LDUser.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder(LDUser user)
Creates a builder based on an existing user.
|
Builder(java.lang.String key)
Creates a builder with the specified key.
|
Modifier and Type | Method and Description |
---|---|
LDUser.Builder |
anonymous(boolean anonymous)
Sets whether this user is anonymous.
|
LDUser.Builder |
avatar(java.lang.String avatar)
Sets the user's avatar.
|
LDUser |
build()
Builds the configured
LDUser object. |
LDUser.Builder |
country(LDCountryCode country)
Deprecated.
As of version 4.10.0. In the next major release the SDK will no longer include the
LDCountryCode class. Applications should use
country(String) instead. |
LDUser.Builder |
country(java.lang.String s)
Set the country for a user.
|
LDUser.Builder |
custom(java.lang.String k,
java.lang.Boolean b)
Add a
Boolean -valued custom attribute. |
LDUser.Builder |
custom(java.lang.String k,
com.google.gson.JsonElement v)
Deprecated.
|
LDUser.Builder |
custom(java.lang.String k,
LDValue v)
Add a custom attribute whose value can be any JSON type, using
LDValue . |
LDUser.Builder |
custom(java.lang.String k,
java.lang.Number n)
Adds a
Number -valued custom attribute. |
LDUser.Builder |
custom(java.lang.String k,
java.lang.String v)
Adds a
String -valued custom attribute. |
LDUser.Builder |
customNumber(java.lang.String k,
java.util.List<java.lang.Number> vs)
Add a list of
Number -valued custom attributes. |
LDUser.Builder |
customString(java.lang.String k,
java.util.List<java.lang.String> vs)
Add a list of
String -valued custom attributes. |
LDUser.Builder |
customValues(java.lang.String k,
java.util.List<com.google.gson.JsonElement> vs)
Add a custom attribute with a list of arbitrary JSON values.
|
LDUser.Builder |
email(java.lang.String email)
Sets the user's e-mail address.
|
LDUser.Builder |
firstName(java.lang.String firstName)
Sets the user's first name
|
LDUser.Builder |
ip(java.lang.String s)
Sets the IP for a user.
|
LDUser.Builder |
lastName(java.lang.String lastName)
Sets the user's last name.
|
LDUser.Builder |
name(java.lang.String name)
Sets the user's full name.
|
LDUser.Builder |
privateAvatar(java.lang.String avatar)
Sets the user's avatar, and ensures that the avatar attribute will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateCountry(LDCountryCode country)
Deprecated.
As of version 4.10.0. In the next major release the SDK will no longer include the
LDCountryCode class. Applications should use
privateCountry(String) instead. |
LDUser.Builder |
privateCountry(java.lang.String s)
Set the country for a user, and ensures that the country attribute will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateCustom(java.lang.String k,
java.lang.Boolean b)
Add a
Boolean -valued custom attribute that will not be sent back to LaunchDarkly. |
LDUser.Builder |
privateCustom(java.lang.String k,
com.google.gson.JsonElement v)
Deprecated.
|
LDUser.Builder |
privateCustom(java.lang.String k,
LDValue v)
Add a custom attribute of any JSON type, that will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateCustom(java.lang.String k,
java.lang.Number n)
Add a
Number -valued custom attribute that will not be sent back to LaunchDarkly. |
LDUser.Builder |
privateCustom(java.lang.String k,
java.lang.String v)
Add a
String -valued custom attribute that will not be sent back to LaunchDarkly. |
LDUser.Builder |
privateCustomNumber(java.lang.String k,
java.util.List<java.lang.Number> vs)
Add a list of
Integer -valued custom attributes. |
LDUser.Builder |
privateCustomString(java.lang.String k,
java.util.List<java.lang.String> vs)
Add a list of
String -valued custom attributes. |
LDUser.Builder |
privateCustomValues(java.lang.String k,
java.util.List<com.google.gson.JsonElement> vs)
Add a custom attribute with a list of arbitrary JSON values.
|
LDUser.Builder |
privateEmail(java.lang.String email)
Sets the user's e-mail address, and ensures that the e-mail address attribute will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateFirstName(java.lang.String firstName)
Sets the user's first name, and ensures that the first name attribute will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateIp(java.lang.String s)
Sets the IP for a user, and ensures that the IP attribute is not sent back to LaunchDarkly.
|
LDUser.Builder |
privateLastName(java.lang.String lastName)
Sets the user's last name, and ensures that the last name attribute will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateName(java.lang.String name)
Sets the user's full name, and ensures that the name attribute will not be sent back to LaunchDarkly.
|
LDUser.Builder |
privateSecondary(java.lang.String s)
Sets the secondary key for a user, and ensures that the secondary key attribute is not sent back to
LaunchDarkly.
|
LDUser.Builder |
secondary(java.lang.String s)
Sets the secondary key for a user.
|
public Builder(java.lang.String key)
key
- the unique key for this userpublic Builder(LDUser user)
user
- an existing LDUser
public LDUser.Builder ip(java.lang.String s)
s
- the IP address for the userpublic LDUser.Builder privateIp(java.lang.String s)
s
- the IP address for the userpublic LDUser.Builder secondary(java.lang.String s)
s
- the secondary key for the userpublic LDUser.Builder privateSecondary(java.lang.String s)
s
- the secondary key for the userpublic LDUser.Builder country(java.lang.String s)
In the current SDK version the country should be a valid ISO 3166-1 alpha-2 or alpha-3 code. If it is not a valid ISO-3166-1 code, an attempt will be made to look up the country by its name. If that fails, a warning will be logged, and the country will not be set. In the next major release, this validation will be removed, and the country field will be treated as a normal string.
s
- the country for the userpublic LDUser.Builder privateCountry(java.lang.String s)
In the current SDK version the country should be a valid ISO 3166-1 alpha-2 or alpha-3 code. If it is not a valid ISO-3166-1 code, an attempt will be made to look up the country by its name. If that fails, a warning will be logged, and the country will not be set. In the next major release, this validation will be removed, and the country field will be treated as a normal string.
s
- the country for the user@Deprecated public LDUser.Builder country(LDCountryCode country)
country(String)
instead.country
- the country for the user@Deprecated public LDUser.Builder privateCountry(LDCountryCode country)
privateCountry(String)
instead.country
- the country for the userpublic LDUser.Builder firstName(java.lang.String firstName)
firstName
- the user's first namepublic LDUser.Builder privateFirstName(java.lang.String firstName)
firstName
- the user's first namepublic LDUser.Builder anonymous(boolean anonymous)
anonymous
- whether the user is anonymouspublic LDUser.Builder lastName(java.lang.String lastName)
lastName
- the user's last namepublic LDUser.Builder privateLastName(java.lang.String lastName)
lastName
- the user's last namepublic LDUser.Builder name(java.lang.String name)
name
- the user's full namepublic LDUser.Builder privateName(java.lang.String name)
name
- the user's full namepublic LDUser.Builder avatar(java.lang.String avatar)
avatar
- the user's avatarpublic LDUser.Builder privateAvatar(java.lang.String avatar)
avatar
- the user's avatarpublic LDUser.Builder email(java.lang.String email)
email
- the e-mail addresspublic LDUser.Builder privateEmail(java.lang.String email)
email
- the e-mail addresspublic LDUser.Builder custom(java.lang.String k, java.lang.String v)
String
-valued custom attribute. When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributev
- the value for the custom attributepublic LDUser.Builder custom(java.lang.String k, java.lang.Number n)
Number
-valued custom attribute. When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributen
- the value for the custom attributepublic LDUser.Builder custom(java.lang.String k, java.lang.Boolean b)
Boolean
-valued custom attribute. When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributeb
- the value for the custom attributepublic LDUser.Builder custom(java.lang.String k, LDValue v)
LDValue
. When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributev
- the value for the custom attribute@Deprecated public LDUser.Builder custom(java.lang.String k, com.google.gson.JsonElement v)
custom(String, LDValue)
.custom(String, LDValue)
but uses the Gson type JsonElement
. Using LDValue
is preferred; the Gson types may be removed
from the public API in the future.k
- the key for the custom attributev
- the value for the custom attributepublic LDUser.Builder customString(java.lang.String k, java.util.List<java.lang.String> vs)
String
-valued custom attributes. When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the listvs
- the values for the attributepublic LDUser.Builder customNumber(java.lang.String k, java.util.List<java.lang.Number> vs)
Number
-valued custom attributes. When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the listvs
- the values for the attributepublic LDUser.Builder customValues(java.lang.String k, java.util.List<com.google.gson.JsonElement> vs)
k
- the key for the listvs
- the values for the attributepublic LDUser.Builder privateCustom(java.lang.String k, java.lang.String v)
String
-valued custom attribute that will not be sent back to LaunchDarkly.
When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributev
- the value for the custom attributepublic LDUser.Builder privateCustom(java.lang.String k, java.lang.Number n)
Number
-valued custom attribute that will not be sent back to LaunchDarkly.
When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributen
- the value for the custom attributepublic LDUser.Builder privateCustom(java.lang.String k, java.lang.Boolean b)
Boolean
-valued custom attribute that will not be sent back to LaunchDarkly.
When set to one of the
built-in
user attribute keys, this custom attribute will be ignored.k
- the key for the custom attributeb
- the value for the custom attributepublic LDUser.Builder privateCustom(java.lang.String k, LDValue v)
k
- the key for the custom attributev
- the value for the custom attribute@Deprecated public LDUser.Builder privateCustom(java.lang.String k, com.google.gson.JsonElement v)
privateCustom(String, LDValue)
.k
- the key for the custom attributev
- the value for the custom attributepublic LDUser.Builder privateCustomString(java.lang.String k, java.util.List<java.lang.String> vs)
String
-valued custom attributes. When set to one of the
built-in user attribute keys, this custom attribute will be ignored. The custom attribute value will not be sent
back to LaunchDarkly in analytics events.k
- the key for the list. When set to one of the built-in user attribute keys, this custom attribute will be ignored.vs
- the values for the attributepublic LDUser.Builder privateCustomNumber(java.lang.String k, java.util.List<java.lang.Number> vs)
Integer
-valued custom attributes. When set to one of the
built-in user attribute keys, this custom attribute will be ignored. The custom attribute value will not be sent
back to LaunchDarkly in analytics events.k
- the key for the list. When set to one of the built-in user attribute keys, this custom attribute will be ignored.vs
- the values for the attributepublic LDUser.Builder privateCustomValues(java.lang.String k, java.util.List<com.google.gson.JsonElement> vs)
k
- the key for the listvs
- the values for the attribute