com.vaadin.flow.component.
Interface WebComponentExporterFactory<C extends Component>
Type Parameters:
C
- type of the component to export
All Superinterfaces:
All Known Implementing Classes:
WebComponentExporterFactory.DefaultWebComponentExporterFactory
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Exports a 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.
Author:
Vaadin Ltd
See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Default factory implementation which uses an exporter class to instantiate it using its default constructor.
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Creates a new
WebComponentExporter
instance and configures the tag name of the web component created based on this exporter.
-
Method Details
-
create
WebComponentExporter<C> create()Creates a new
WebComponentExporter
instance and configures the tag name of the web component created based on this exporter.Returns:
an exporter instance
See Also:
-