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 multipleContextinstances, usually stored together in aSet.Any single
Contextattribute 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
Contextuals circumstance within a given world would have key of "world" and a value equal to the name of the world.Contextis immutable. ThesetValue(String)inherited fromMap.Entryis not supported.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDIMENSION_KEYstatic StringLOCAL_HOST_KEYstatic StringLOCAL_IP_KEYstatic StringLOCAL_PORT_KEYstatic StringREMOTE_IP_KEYstatic StringUSER_KEYstatic StringWORLD_KEY
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object other)StringgetKey()Gets the context key.StringgetValue()Gets the context value.inthashCode()StringsetValue(String value)Deprecated.Context does not support changing the valuesStringtoString()
-
-
-
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:
setValuein 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()
-
-