use of com.vaadin.flow.router.RouteAlias in project flow by vaadin.
the class AbstractRouteRegistryInitializer method checkForConflictingAnnotations.
private void checkForConflictingAnnotations(Class<?> route) {
if (route.isAnnotationPresent(RouteAlias.class) && !route.isAnnotationPresent(Route.class)) {
throw new InvalidRouteLayoutConfigurationException(String.format("'%s'" + " declares '@%s' but doesn't declare '@%s'. " + "The '%s' may not be used without '%s'", route.getCanonicalName(), RouteAlias.class.getSimpleName(), Route.class.getSimpleName(), RouteAlias.class.getSimpleName(), Route.class.getSimpleName()));
}
if (route.isAnnotationPresent(PageTitle.class) && HasDynamicTitle.class.isAssignableFrom(route)) {
throw new DuplicateNavigationTitleException(String.format("'%s' has a PageTitle annotation, but also implements HasDynamicTitle.", route.getName()));
}
/* Validate annotation usage */
Stream.of(AnnotationValidator.class.getAnnotation(HandlesTypes.class).value()).forEach(type -> {
Class<? extends Annotation> annotation = type.asSubclass(Annotation.class);
validateRouteAnnotation(route, annotation);
for (RouteAlias alias : route.getAnnotationsByType(RouteAlias.class)) {
validateRouteAliasAnnotation(route, alias, annotation);
}
});
/* Validate PageConfigurator usage */
validateRouteImplementation(route, PageConfigurator.class);
for (RouteAlias alias : route.getAnnotationsByType(RouteAlias.class)) {
validateRouteAliasImplementation(route, alias, PageConfigurator.class);
}
}
Aggregations