use of com.vaadin.flow.router.legacy.RouterConfigurator in project flow by vaadin.
the class VaadinService method configureRouter.
private void configureRouter(String configuratorClassName) throws ServiceException {
try {
Class<?> configuratorClass = Class.forName(configuratorClassName, true, getClassLoader());
if (!RouterConfigurator.class.isAssignableFrom(configuratorClass)) {
throw new IllegalStateException("The defined router configurator class " + configuratorClassName + " does not implement " + RouterConfigurator.class.getName());
}
if (configuratorClass.getDeclaringClass() != null && !Modifier.isStatic(configuratorClass.getModifiers())) {
throw new ServiceException("Configurator class " + configuratorClassName + " cannot be a non-static inner class. " + "If an inner class is used, it must be static.");
}
RouterConfigurator configurator = (RouterConfigurator) ReflectTools.createInstance(configuratorClass);
getRouter().reconfigure(configurator);
} catch (ClassNotFoundException e) {
throw new ServiceException("Could not find router class " + configuratorClassName, e);
}
}
Aggregations