Class Context
- java.lang.Object
-
- org.spongepowered.api.service.context.Context
-
public final class Context extends Object implements Map.Entry<String,String>
Encapsulates a single attribute about the state or circumstances of aContextual
.A
Contextual
's overall "context" is made up multipleContext
instances, usually stored together in aSet
.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. ThesetValue(String)
inherited fromMap.Entry
is not supported.
-
-
Field Summary
Fields Modifier and Type Field 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
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object other)
String
getKey()
Gets the context key.String
getValue()
Gets the context value.int
hashCode()
String
setValue(String value)
Deprecated.Context does not support changing the valuesString
toString()
-
-
-
Field Detail
-
USER_KEY
public static final String USER_KEY
- See Also:
- Constant Field Values
-
WORLD_KEY
public static final String WORLD_KEY
- See Also:
- Constant Field Values
-
DIMENSION_KEY
public static final String DIMENSION_KEY
- See Also:
- Constant Field Values
-
REMOTE_IP_KEY
public static final String REMOTE_IP_KEY
- See Also:
- Constant Field Values
-
LOCAL_HOST_KEY
public static final String LOCAL_HOST_KEY
- See Also:
- Constant Field Values
-
LOCAL_IP_KEY
public static final String LOCAL_IP_KEY
- See Also:
- Constant Field Values
-
LOCAL_PORT_KEY
public static final String LOCAL_PORT_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getKey
public String getKey()
Gets the context key.
-
getValue
public String getValue()
Gets the context value.
-
setValue
@Deprecated public String setValue(String value)
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
public boolean equals(Object other)
-
hashCode
public int hashCode()
-
-