public final class ContextKind extends java.lang.Object implements java.lang.Comparable<ContextKind>, JsonSerializable
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:
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.
Modifier and Type | Field and Description |
---|---|
static ContextKind |
DEFAULT
A constant for the default kind of "user".
|
static ContextKind |
MULTI
A constant for the kind that all multi-kind contexts have.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ContextKind o) |
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
boolean |
isDefault()
True if this is equal to
DEFAULT ("user"). |
static ContextKind |
of(java.lang.String stringValue)
Constructor from a string value.
|
java.lang.String |
toString()
Returns the string value of the context kind.
|
public static final ContextKind DEFAULT
public static final ContextKind MULTI
public static ContextKind of(java.lang.String stringValue)
A value of null or "" will be changed to DEFAULT
.
stringValue
- the string valuepublic boolean isDefault()
DEFAULT
("user").public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(ContextKind o)
compareTo
in interface java.lang.Comparable<ContextKind>