public interface VaadinContext extends Serializable
VaadinService is running.
This is used to store service-scoped attributes and also works as a wrapper
for context objects with properties e.g. ServletContext and
PortletContext| Modifier and Type | Method and Description |
|---|---|
default <T> T |
getAttribute(Class<T> type)
Returns value of the specified attribute.
|
<T> T |
getAttribute(Class<T> type,
Supplier<T> defaultValueSupplier)
Returns value of the specified attribute, creating a default value if not
present.
|
String |
getContextParameter(String name)
Returns the value for the requested parameter, or
null if
the parameter does not exist. |
Enumeration<String> |
getContextParameterNames()
Returns the names of the initialization parameters as an
Enumeration, or an empty Enumeration if there
are o initialization parameters. |
void |
removeAttribute(Class<?> clazz)
Removes an attribute identified by the given type.
|
<T> void |
setAttribute(Class<T> clazz,
T value)
Sets the attribute value for the give type, overriding previously
existing one.
|
default void |
setAttribute(Object value)
Sets the attribute value, overriding previously existing one.
|
<T> T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)
type - Type of the attribute.defaultValueSupplier - Supplier of the default value, called when there is no
value already present. May be null.default <T> T getAttribute(Class<T> type)
type - Type of the attribute.<T> void setAttribute(Class<T> clazz, T value)
clazz - the type to associate the value with, not nullvalue - the attribute value to set, or null to remove the
current valuedefault void setAttribute(Object value)
value - attribute value, not null.for removing attributes.void removeAttribute(Class<?> clazz)
clazz - Attribute type.for setting attributes.Enumeration<String> getContextParameterNames()
Enumeration, or an empty Enumeration if there
are o initialization parameters.EnumerationCopyright © 2021. All rights reserved.