public class FlashScopeImpl extends Object implements FlashScope
| Constructor and Description |
|---|
FlashScopeImpl(NinjaProperties ninjaProperties) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCurrentFlashCookieData()
Clears all "current" flash data.
|
boolean |
contains(String key)
Checks if the key exists in the "current" flash data.
|
void |
discard()
Discards all "outgoing" flash data but retains all "current" flash data.
|
void |
discard(String key)
Discards the key from the "outgoing" flash data but retains it in the
"current" flash data.
|
void |
error(String value)
Same as calling
flash.put("error", "your value");. |
String |
get(String key)
Gets a value if its in either the "current" or "outgoing" flash data.
|
Map<String,String> |
getCurrentFlashCookieData()
Gets all "current" flash data.
|
Map<String,String> |
getOutgoingFlashCookieData()
Gets all "outgoing" flash data.
|
void |
init(Context context)
Intended for use by implementations only.
|
void |
keep()
Copies all "current" flash data into the "outgoing" flash data.
|
void |
keep(String key)
Will copy the "current" flash data specified by the key into the "outgoing"
flash data.
|
void |
now(String key,
String value)
Puts the key and value into only the "current" flash data.
|
void |
put(String key,
Object value) |
void |
put(String key,
String value)
Puts the key and value into both "current" and "outgoing" flash data.
|
boolean |
remove(String key)
Removes a value completely from both "current" and "outgoing" flash data.
|
void |
save(Context context)
Intended for use by implementations only.
|
void |
success(String value)
Same as calling
flash.put("success", "your value");. |
@Inject public FlashScopeImpl(NinjaProperties ninjaProperties)
public void init(Context context)
FlashScopeinit in interface FlashScopecontext - The Ninja contextpublic void save(Context context)
FlashScopesave in interface FlashScopecontext - The Ninja contextpublic void now(String key, String value)
FlashScopenow in interface FlashScopekey - The flash keyvalue - The i18n key used to retrieve value of that message
OR an already translated message (if your template engine supports it)If you need the value for
both the current and next requestpublic String get(String key)
FlashScopeget in interface FlashScopekey - The flash keypublic boolean remove(String key)
FlashScoperemove in interface FlashScopekey - The flash keypublic boolean contains(String key)
FlashScopecontains in interface FlashScopekey - The flash keypublic void put(String key, String value)
FlashScopenow() method instead so you can eliminate the possibility
of showing unexpected flash messages on the next request :-).put in interface FlashScopekey - The flash keyvalue - The i18n key used to retrieve value of that message
OR an already translated message (if your template engine supports it)If you only need the value
in your current request.public void put(String key, Object value)
put in interface FlashScopepublic void error(String value)
FlashScopeflash.put("error", "your value");. The value
will be added to both "current" and "outgoing" flash data.error in interface FlashScopevalue - The i18n key used to retrieve value of that message
OR an already translated message (if your template engine supports it)public void success(String value)
FlashScopeflash.put("success", "your value");. The value
will be added to both "current" and "outgoing" flash data.success in interface FlashScopevalue - The i18n key used to retrieve value of that message
OR an already translated message (if your template engine supports it)public void discard(String key)
FlashScopediscard in interface FlashScopekey - The flash keyTo reverse this operation and keep the key
as part of the "outgoing" flash data.public void discard()
FlashScopediscard in interface FlashScopeTo reverse this operation and keep all keys as part of the
"outgoing" flash data.public void keep(String key)
FlashScopekeep in interface FlashScopekey - The flash keypublic void keep()
FlashScopekeep in interface FlashScopepublic void clearCurrentFlashCookieData()
FlashScopeclearCurrentFlashCookieData in interface FlashScopepublic Map<String,String> getCurrentFlashCookieData()
FlashScopegetCurrentFlashCookieData in interface FlashScopepublic Map<String,String> getOutgoingFlashCookieData()
FlashScopegetOutgoingFlashCookieData in interface FlashScopeCopyright © 2019 ninjaframework. All rights reserved.