public interface FlashScope
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)
Deprecated.
Convert your value to a String in your application since
this method implies Serialization could be used (which is not true).
|
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"); . |
void init(Context context)
context
- The Ninja contextvoid save(Context context)
context
- The Ninja contextString get(String key)
key
- The flash keyboolean remove(String key)
key
- The flash keyboolean contains(String key)
key
- The flash keyvoid now(String key, String value)
key
- 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 request
void put(String key, String value)
now()
method instead so you can eliminate the possibility
of showing unexpected flash messages on the next request :-).key
- 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.
@Deprecated void put(String key, Object value)
void discard(String key)
key
- The flash keyTo reverse this operation and keep the key
as part of the "outgoing" flash data.
void discard()
void keep(String key)
key
- The flash keyvoid keep()
void error(String value)
flash.put("error", "your value");
. The value
will be added to both "current" and "outgoing" flash data.value
- The i18n key used to retrieve value of that message
OR an already translated message (if your template engine supports it)void success(String value)
flash.put("success", "your value");
. The value
will be added to both "current" and "outgoing" flash data.value
- The i18n key used to retrieve value of that message
OR an already translated message (if your template engine supports it)void clearCurrentFlashCookieData()
Map<String,String> getCurrentFlashCookieData()
Copyright © 2019 ninjaframework. All rights reserved.