The component interface contains a method line this:
/**
* Match on the type of component.
*
* @param context A context value passed through to the given functions
* @param on_button A function evaluated if this component is a button
* @param on_panel A function evaluated if this component is a panel
* @param on_label A function evaluated if this component is a label
* @param on_image A function evaluated if this component is an image
* @param on_meter A function evaluated if this component is a meter
* @param <A> The type of opaque context values
* @param <B> The type of returned values
*
* @return The value returned by whichever one of the given functions is evaluated
*/
<A, B> B matchComponent(
A context,
BiFunction<A, SyButtonType, B> on_button,
BiFunction<A, SyPanelType, B> on_panel,
BiFunction<A, SyLabelType, B> on_label,
BiFunction<A, SyImageType, B> on_image,
BiFunction<A, SyMeterType, B> on_meter);
This is obviously a generic visitor, and now the component type should be a sealed interface instead.
The component interface contains a method line this:
This is obviously a generic visitor, and now the component type should be a sealed interface instead.