Class Context
java.lang.Object
org.spongepowered.api.service.context.Context
Encapsulates a single attribute about the state or circumstances of a
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.
-
Field Details
-
USER_KEY
- See Also:
-
WORLD_KEY
- See Also:
-
DIMENSION_KEY
- See Also:
-
REMOTE_IP_KEY
- See Also:
-
LOCAL_HOST_KEY
- See Also:
-
LOCAL_IP_KEY
- See Also:
-
LOCAL_PORT_KEY
- See Also:
-
-
Constructor Details
-
Context
Create a new context instance.- Parameters:
key
- Context key. Must not be null.value
- Context value. Must not be null.
-
-
Method Details
-
getKey
Gets the context key. -
getValue
Gets the context value. -
setValue
Deprecated.Context does not support changing the values- Specified by:
setValue
in interfaceMap.Entry<String,
String> - Parameters:
value
- The value- Returns:
- Nothing
- Throws:
UnsupportedOperationException
- Contexts are immutable
-
equals
-
hashCode
public int hashCode() -
toString
-