Package org.spincast.core.exchange
Interface VariablesRequestContextAddon<R extends RequestContext<?>>
- All Known Implementing Classes:
SpincastVariablesRequestContextAddon
public interface VariablesRequestContextAddon<R extends RequestContext<?>>
Methods to read and write request scoped variables.
-
Method Summary
Modifier and TypeMethodDescriptionGets the specified request scoped variable.<T> T
Gets the specified request scoped variable as the specifiedKey
.<T> T
Gets the specified request scoped variable as the specified class.getAll()
Gets all the request scoped variables.getAsJsonObject
(String key) Gets the specified request scoped variable asJsonObject
.getAsString
(String key) Gets the specified request scoped variable as a String.void
Removes a request scoped variable.void
Adds a request scoped variable.void
Adds request scoped variables.
-
Method Details
-
set
Adds a request scoped variable.It is recommended that you prefixe the name of the
key
with the name of your class (for example :this.getClass().getName()
), so it doesn't clash with other keys!If the variable already exists, it is overwritten.
-
set
Adds request scoped variables.It is recommended that you prefixe the name of the
keys
with the name of your class (for example :this.getClass().getName()
), so they don't clash with other keys!If some variables already exist, they are overwritten.
-
getAll
Gets all the request scoped variables. The map is immutable. -
get
Gets the specified request scoped variable. -
get
Gets the specified request scoped variable as the specified class.- Throws:
an
- exception is the object is not of the specified class.
-
get
Gets the specified request scoped variable as the specifiedKey
.- Throws:
an
- exception is the object is not of the specified Key.
-
getAsJsonObject
Gets the specified request scoped variable asJsonObject
. -
getAsString
Gets the specified request scoped variable as a String.toString
will be called on the Object. -
remove
Removes a request scoped variable. Note: Spincast uses some request scoped variables for internal purposes. Do not try to remove all variables!
-