public final class Context extends Object implements Map.Entry<String,String>
Contextual
.
A Contextual
's overall "context" is made up multiple
Context
instances, usually stored together in a
Set
.
Any single Context
attribute is made up of a key and a
value. The key represents the type of context, and the value is just
that, the value associated with the key. Some common/shared keys are
expressed as static fields on this class for convenience.
For example, a context encapsulating a Contextual
s circumstance
within a given world would have key of "world" and a value equal to the name
of the world.
Context
is immutable. The setValue(String)
inherited from
Map.Entry
is not supported.
Modifier and Type | Field and Description |
---|---|
static String |
DIMENSION_KEY |
static String |
LOCAL_HOST_KEY |
static String |
LOCAL_IP_KEY |
static String |
LOCAL_PORT_KEY |
static String |
REMOTE_IP_KEY |
static String |
USER_KEY |
static String |
WORLD_KEY |
Constructor and Description |
---|
Context(String key,
String value)
Create a new context instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getKey()
Gets the context key.
|
String |
getName()
Deprecated.
This method name is misleading - contexts only have a "key"
and "value". It is not immediately clear what "name" relates
to. (it could reasonably be either key or value)
|
String |
getType()
Deprecated.
The presence of this method is misleading - the context
"type" is the same value as the "key". They are not separate
attributes, as the presence of two distinct methods would
otherwise suggest.
|
String |
getValue()
Gets the context value.
|
int |
hashCode() |
String |
setValue(String value)
Deprecated.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue
public static final String USER_KEY
public static final String WORLD_KEY
public static final String DIMENSION_KEY
public static final String REMOTE_IP_KEY
public static final String LOCAL_HOST_KEY
public static final String LOCAL_IP_KEY
public static final String LOCAL_PORT_KEY
public String getKey()
public String getValue()
@Deprecated public String getType()
getKey()
.@Deprecated public String getName()
getValue()
.@Deprecated public String setValue(String value)
public boolean equals(Object o)
public int hashCode()