Class User.Builder
- java.lang.Object
-
- com.configcat.User.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Userbuild(java.lang.String identifier)Builds the configuredUserinstance.User.Buildercountry(java.lang.String country)Optional.User.Buildercustom(java.util.Map<java.lang.String,java.lang.Object> custom)Optional.User.Builderemail(java.lang.String email)Optional.
-
-
-
Method Detail
-
email
public User.Builder email(java.lang.String email)
Optional. Sets the email of the user.- Parameters:
email- the email address.- Returns:
- the builder.
-
country
public User.Builder country(java.lang.String country)
Optional. Sets the country of the user.- Parameters:
country- the country.- Returns:
- the builder.
-
custom
public User.Builder custom(java.util.Map<java.lang.String,java.lang.Object> custom)
Optional. Sets the custom attributes of a userCustom attributes of the user for advanced targeting rule definitions (e.g. user role, subscription type, etc.)
The set of allowed attribute values depends on the comparison type of the condition which references the User Object attribute.
Stringvalues are supported by all comparison types (in some cases they need to be provided in a specific format though).
Some of the comparison types work with other types of values, as described below.Text-based comparisons (EQUALS, IS ONE OF, etc.)
- accept
Stringvalues, - all other values are automatically converted to string (a warning will be logged but evaluation will continue as normal).
SemVer-based comparisons (IS ONE OF, <, >=, etc.)
- accept
Stringvalues containing a properly formatted, valid semver value, - all other values are considered invalid (a warning will be logged and the currently evaluated targeting rule will be skipped).
Number-based comparisons (=, <, >=, etc.)
- accept
Doublevalues (except forDouble.NaN) and all other numeric values which can safely be converted toDouble - accept
Stringvalues containing a properly formatted, validDoublevalue - all other values are considered invalid (a warning will be logged and the currently evaluated targeting rule will be skipped).
Date time-based comparisons (BEFORE / AFTER)
- accept
Datevalues, which are automatically converted to a second-based Unix timestamp - accept
Instantvalues, which are automatically converted to a second-based Unix timestamp - accept
Doublevalues (except forDouble.NaN) representing a second-based Unix timestamp and all other numeric values which can safely be converted toDouble - accept
Stringvalues containing a properly formatted, validDoublevalue - all other values are considered invalid (a warning will be logged and the currently evaluated targeting rule will be skipped).
String array-based comparisons (ARRAY CONTAINS ANY OF / ARRAY NOT CONTAINS ANY OF)
- accept arrays of
String - accept
ListofString - accept
Stringvalues containing a valid JSON string which can be deserialized to an array ofString - all other values are considered invalid (a warning will be logged and the currently evaluated targeting rule will be skipped).
In case a non-string attribute value needs to be converted to
Stringduring evaluation, it will always be done using the same format which is accepted by the comparisons.- Parameters:
custom- the custom attributes.- Returns:
- the builder.
- accept
-
-