Class ContextKind
- All Implemented Interfaces:
JsonSerializable,Comparable<ContextKind>
LDContext represents.
The type is a simple wrapper for a String. Using a type that is not just String
makes it clearer where a context kind is expected or returned in the SDK API, so it
cannot be confused with other important strings such as the context key. To convert
a literal string to this type, use the factory method of(String).
The meaning of the context kind is completely up to the application. Validation rules are as follows:
- It may only contain letters, numbers, and the characters ".", "_", and "-".
- It cannot equal the literal string "kind".
- For a single-kind context, it cannot equal "multi".
If no kind is specified, the default is "user" (the constant DEFAULT).
For a multi-kind context (see LDContext.createMulti(LDContext...)), the kind of
the top-level LDContext is always "multi" (the constant MULTI); there is a
specific Kind for each of the contexts contained within it.
To learn more, read the documentation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ContextKindA constant for the default kind of "user".static final ContextKindA constant for the kind that all multi-kind contexts have. -
Method Summary
Modifier and TypeMethodDescriptionintbooleaninthashCode()booleanTrue if this is equal toDEFAULT("user").static ContextKindConstructor from a string value.toString()Returns the string value of the context kind.
-
Field Details
-
DEFAULT
A constant for the default kind of "user". -
MULTI
A constant for the kind that all multi-kind contexts have.
-
-
Method Details
-
of
Constructor from a string value.A value of null or "" will be changed to
DEFAULT.- Parameters:
stringValue- the string value- Returns:
- a ContextKind
-
isDefault
public boolean isDefault()True if this is equal toDEFAULT("user").- Returns:
- true if this is the default kind
-
toString
Returns the string value of the context kind. This is never null. -
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<ContextKind>
-