-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.context.Extras
public final class DefaultExtras implements Extras
The default implementation of Extras.
-
-
Constructor Summary
Constructors Constructor Description DefaultExtras()
-
Method Summary
Modifier and Type Method Description UnitputExtra(Object key, Object value)Saves an extra. BooleanhasExtra(Object key)Checks whether an extra with the given key exists. <T extends Any> TgetExtra(Object key)Retrieves the value of the extra with the given key, unless no such extra exists. <T extends Any> TconsumeExtra(Object key)Retrieves the value of the extra with the given key, unless no such extra exists. UnitclearExtras()Removes all stored extras. -
-
Method Detail
-
putExtra
Unit putExtra(Object key, Object value)
Saves an extra.
- Parameters:
key- the extra’s unique identifier.value- the extra’s value.
-
getExtra
<T extends Any> T getExtra(Object key)
Retrieves the value of the extra with the given key, unless no such extra exists.
-
consumeExtra
<T extends Any> T consumeExtra(Object key)
Retrieves the value of the extra with the given key, unless no such extra exists. Once the value of the extra is retrieved, the extra is removed. Use getExtra to prevent the extra from being removed.
-
clearExtras
Unit clearExtras()
Removes all stored extras.
-
-
-
-