Class WebComponentConfigurationRegistry
java.lang.Object
com.vaadin.flow.server.webcomponent.WebComponentConfigurationRegistry
- All Implemented Interfaces:
Serializable
Registry for storing available web component configuration implementations.
For internal use only. May be renamed or removed in a future release.
- Since:
- 2.0
- Author:
- Vaadin Ltd.
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
Protected constructor for internal OSGi extensions. -
Method Summary
Modifier and TypeMethodDescriptionOptional<WebComponentConfiguration<? extends Component>>
getConfiguration
(String tag) Get a web component configuration for given custom element tag if one is registered.Set<WebComponentConfiguration<? extends Component>>
Get an unmodifiable set containing all registered web component configurations.<T extends Component>
Set<WebComponentConfiguration<T>>getConfigurationsByComponentType
(Class<T> componentClass) Get an unmodifiable set containing all registered web component configurations for a specificComponent
type.<T extends Annotation>
Optional<T>getEmbeddedApplicationAnnotation
(Class<T> type) Returns configuration annotation for embedded application.getInstance
(VaadinContext context) Get WebComponentRegistry instance for given servlet context.Get a copy of the elements that should be added to the shadow dom hosting the embedded web component.boolean
Checks whether the registry contains any web component configurations.boolean
setConfigurations
(Set<WebComponentConfiguration<? extends Component>> configurations) Registers all available web component configurations to the registry.void
setShadowDomElements
(List<Element> elements) Set the elements that should be added to each shadow dom hosting an embedded web component.protected void
updateRegistry
(Set<WebComponentConfiguration<? extends Component>> configurations) Internal method for updating registry.
-
Constructor Details
-
WebComponentConfigurationRegistry
protected WebComponentConfigurationRegistry()Protected constructor for internal OSGi extensions.
-
-
Method Details
-
getConfiguration
Get a web component configuration for given custom element tag if one is registered.- Parameters:
tag
- custom element tag- Returns:
- Optional containing a web component configuration matching given tag
-
getConfigurationsByComponentType
public <T extends Component> Set<WebComponentConfiguration<T>> getConfigurationsByComponentType(Class<T> componentClass) Get an unmodifiable set containing all registered web component configurations for a specificComponent
type.- Type Parameters:
T
- component- Parameters:
componentClass
- type of the exportedComponent
- Returns:
- set of
WebComponentConfiguration
or an empty set.
-
updateRegistry
Internal method for updating registry.- Parameters:
configurations
- set of web component configurations to register
-
setConfigurations
public boolean setConfigurations(Set<WebComponentConfiguration<? extends Component>> configurations) Registers all available web component configurations to the registry.This can be done only once and any following set should only return false.
- Parameters:
configurations
- set of web component configurations to register. These configurations must have both unique and valid tag names.- Returns:
true
if set successfully orfalse
if not set
-
hasConfigurations
public boolean hasConfigurations()Checks whether the registry contains any web component configurations.- Returns:
true
ifsetConfigurations(Set)
has been called a non-empty set.
-
getEmbeddedApplicationAnnotation
Returns configuration annotation for embedded application.WebComponentExporter
classes may declare configuration annotations. If there are several different annotations declared for various exporter classes then an exception will be thrown during the servlet initialization (exporter classes discovering).- Parameters:
type
- the configuration annotation type- Returns:
- an optional configuration annotation, or an empty optional if
there is no configuration annotation with the given
type
-
getConfigurations
Get an unmodifiable set containing all registered web component configurations.- Returns:
- unmodifiable set of web component configurations in registry or an empty set
-
setShadowDomElements
Set the elements that should be added to each shadow dom hosting an embedded web component.- Parameters:
elements
- list of shadow dom elements
-
getShadowDomElements
Get a copy of the elements that should be added to the shadow dom hosting the embedded web component.- Returns:
- copy of shadow dom elements
-
getInstance
Get WebComponentRegistry instance for given servlet context.- Parameters:
context
-VaadinService
to keep the instance in- Returns:
- WebComponentRegistry instance
-