Class LitRendererMigrationExtension
LitRenderer event handler registration across
Vaadin versions.
In Vaadin 24, LitRenderer.withFunction receives a JsonArray from the
elemental.json API directly. In Vaadin 25+, the argument type changed to a Jackson
ArrayNode, so this class wraps the handler to perform the necessary conversion
transparently.
The LitRenderer type referenced here is resolved at runtime via a method handle,
allowing this library to compile against Vaadin 14 while supporting Vaadin 24+.
Note: This class is only useful when running on Vaadin 24 or later. On earlier
versions, LitRenderer is not available and any attempt to use this class will fail at
runtime.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <SOURCE> com.flowingcode.vaadin.jsonmigration.LitRendererMigrationExtension.LitRenderer<SOURCE> withFunction(com.flowingcode.vaadin.jsonmigration.LitRendererMigrationExtension.LitRenderer<SOURCE> renderer, String name, SerializableBiConsumer<SOURCE, elemental.json.JsonArray> handler) Registers an event handler function on the givenLitRenderer.
-
Constructor Details
-
LitRendererMigrationExtension
public LitRendererMigrationExtension()
-
-
Method Details
-
withFunction
public static <SOURCE> com.flowingcode.vaadin.jsonmigration.LitRendererMigrationExtension.LitRenderer<SOURCE> withFunction(com.flowingcode.vaadin.jsonmigration.LitRendererMigrationExtension.LitRenderer<SOURCE> renderer, String name, SerializableBiConsumer<SOURCE, elemental.json.JsonArray> handler) Registers an event handler function on the givenLitRenderer.On Vaadin 25+, the raw argument passed by the client is a Jackson
ArrayNoderather than aJsonArray, so the handler is wrapped to convert it before forwarding.- Type Parameters:
SOURCE- the bean type of the renderer- Parameters:
renderer- theLitRendereron which to register the functionname- the client-side function namehandler- the handler to invoke when the client calls the function; receives the item and aJsonArrayof arguments- Returns:
- the same renderer instance, for chaining
-