C
- type of the component to export@FunctionalInterface public interface WebComponentExporterFactory<C extends Component> extends Serializable
Component
as a web component.
By extending this class you can export a server side Component
with a
given tag name so that it can be included in any web page as
<tag-name>
. You can add properties/attributes to the element, which
are synchronized with the server and you can fire events from the server,
which are available as custom events in the browser.
The tag name (must contain at least one dash and be unique on the target web
page) is provided through the super constructor. Note that the exporter tag
is not related to the tag used by the Component
being exported and
they cannot be the same.
The component class to exported is determined by the parameter given to
WebComponentExporterFactory
when extending it, e.g.
extends WebComponentExporterFactory<MyComponent>
.
You may implement factory instead of direct public implementation of
WebComponentExporter
class in case when it's not convenient or not
possible to extend an abstract class (e.g. your class already extends another
class).
NOTE: the implementation class of the object returned by the
create()
method should not be eligible as
WebComponentExporter
. Otherwise two instances of the same type will
be created which makes a collision. So the implementation class should not be
either public or should not have a default no-arguments constructor.
WebComponentExporter
Modifier and Type | Interface and Description |
---|---|
static class |
WebComponentExporterFactory.DefaultWebComponentExporterFactory<C extends Component>
Default factory implementation which uses an exporter class to
instantiate it using its default constructor.
|
Modifier and Type | Method and Description |
---|---|
WebComponentExporter<C> |
create()
Creates a new
WebComponentExporter instance and configures the
tag name of the web component created based on this exporter. |
WebComponentExporter<C> create()
WebComponentExporter
instance and configures the
tag name of the web component created based on this exporter.WebComponentExporter.WebComponentExporter(String)
Copyright © 2022. All rights reserved.