public class DefaultInstantiator extends Object implements Instantiator
Class.newInstance() and ServiceLoader.| Constructor and Description |
|---|
DefaultInstantiator(VaadinService service)
Creates a new instantiator for the given service.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Component> |
createComponent(Class<T> componentClass)
Creates an instance of a component by its
componentClass. |
I18NProvider |
getI18NProvider()
Get the I18NProvider if one has been defined.
|
<T> T |
getOrCreate(Class<T> type)
Provides an instance of any given type, this is an abstraction that
allows to make use of DI-frameworks from add-ons.
|
Stream<VaadinServiceInitListener> |
getServiceInitListeners()
Gets all service init listeners to use.
|
static Stream<VaadinServiceInitListener> |
getServiceLoaderListeners(ClassLoader classloader)
Helper for finding service init listeners using
ServiceLoader. |
boolean |
init(VaadinService service)
Initializes this instantiator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateRouteTarget, get, getBootstrapListeners, getDependencyFilters, getTemplateParserpublic DefaultInstantiator(VaadinService service)
service - the service to usepublic boolean init(VaadinService service)
Instantiatorfalse. It is recommended that all
implementations provide a way for application developers to disable an
implementation so that it can be present on the classpath without
preventing the application from being deployed in cases when multiple
candidates are available.init in interface Instantiatorservice - the Vaadin service for which this instance is initializedtrue if this instance should be considered as a
candidate for usage for the provided service; false
to opt-out from the selection processpublic Stream<VaadinServiceInitListener> getServiceInitListeners()
InstantiatorServiceLoader convention. This can be done by
including the items from
getServiceInitListeners() in the returned
stream.getServiceInitListeners in interface Instantiatornullpublic <T> T getOrCreate(Class<T> type)
InstantiatorHow the object is created and whether it is being cached or not is up to the implementation.
getOrCreate in interface InstantiatorT - the type of the instance to createtype - the instance type to create, not nullpublic <T extends Component> T createComponent(Class<T> componentClass)
InstantiatorcomponentClass.createComponent in interface InstantiatorT - the component typecomponentClass - the instance type to create, not nullnullpublic static Stream<VaadinServiceInitListener> getServiceLoaderListeners(ClassLoader classloader)
ServiceLoader.classloader - the classloader to use for finding the listenerspublic I18NProvider getI18NProvider()
InstantiatorgetI18NProvider in interface InstantiatorCopyright © 2025. All rights reserved.