public.javadoc.org.spincast.core.exchange.VariablesRequestContextAddon.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
VariablesRequestContextAddon (org.spincast:spincast-framework 1.0.0 API)
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
All Methods Instance Methods Abstract Methods
Modifier and Type
Method and Description
Object
get(String key)
Gets the specified request scoped variable.
<T> T
get(String key,
Class<T> clazz)
Gets the specified request scoped variable as the
specified class.
<T> T
get(String key,
com.google.inject.Key<T> typeKey)
Gets the specified request scoped variable as the
specified Key
.
Map<String,Object>
getAll()
Gets all the request scoped variables.
JsonObject
getAsJsonObject(String key)
Gets the specified request scoped variable as JsonObject
.
String
getAsString(String key)
Gets the specified request scoped variable as a String.
void
remove(String key)
Removes a request scoped variable.
void
set(Map<String,Object> variables)
Adds request scoped variables.
void
set(String key,
Object obj)
Adds a request scoped variable.
-
-
Method Detail
-
set
void set(String key,
Object obj)
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
void set(Map<String,Object> variables)
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.
-
get
<T> T get(String key,
Class<T> clazz)
Gets the specified request scoped variable as the
specified class.
- Throws:
an
- exception is the object is not
of the specified class.
-
get
<T> T get(String key,
com.google.inject.Key<T> typeKey)
Gets the specified request scoped variable as the
specified Key
.
- Throws:
an
- exception is the object is not
of the specified Key.
-
getAsJsonObject
JsonObject getAsJsonObject(String key)
Gets the specified request scoped variable as JsonObject
.
-
getAsString
String getAsString(String key)
Gets the specified request scoped variable as a String.
toString
will be called on the Object.
-
remove
void remove(String key)
Removes a request scoped variable.
Note: Spincast uses some request scoped variables for
internal purposes. Do not try to remove all
variables!
Copyright © 2019. All rights reserved.