@Test public void getAnnotationFor_widgetsetAnnotationForSubclass_annotationFound() { Assert.assertNotNull("Widgetset annotation is not found for subclass", UIProvider.getAnnotationFor(TestClass.class, Widgetset.class)); }
protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz, Class<T> annotationType) { if (annotationType.getAnnotation(Inherited.class) != null) { T annotation = clazz.getAnnotation(annotationType); if (annotation != null) { return annotation; } } else { Class<?> currentType = clazz; while (currentType != Object.class) { T annotation = currentType.getAnnotation(annotationType); if (annotation != null) { return annotation; } else { currentType = currentType.getSuperclass(); } } } for (Class<?> iface : clazz.getInterfaces()) { T annotation = iface.getAnnotation(annotationType); if (annotation != null) { return annotation; } } return null; }
UIProvider implements Serializable { protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz, Class<T> annotationType) { if (annotationType.getAnnotation(Inherited.class) != null) { T annotation = clazz.getAnnotation(annotationType); if (annotation != null) { return annotation; } } else { Class<?> currentType = clazz; while (currentType != Object.class) { T annotation = currentType.getAnnotation(annotationType); if (annotation != null) { return annotation; } else { currentType = currentType.getSuperclass(); } } } for (Class<?> iface : clazz.getInterfaces()) { T annotation = iface.getAnnotation(annotationType); if (annotation != null) { return annotation; } } return null; } }
UIProvider implements Serializable { protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz, Class<T> annotationType) { if (annotationType.getAnnotation(Inherited.class) != null) { T annotation = clazz.getAnnotation(annotationType); if (annotation != null) { return annotation; } } else { Class<?> currentType = clazz; while (currentType != Object.class) { T annotation = currentType.getAnnotation(annotationType); if (annotation != null) { return annotation; } else { currentType = currentType.getSuperclass(); } } } for (Class<?> iface : clazz.getInterfaces()) { T annotation = iface.getAnnotation(annotationType); if (annotation != null) { return annotation; } } return null; }  }
UIProvider implements Serializable { protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz, Class<T> annotationType) { if (annotationType.getAnnotation(Inherited.class) != null) { T annotation = clazz.getAnnotation(annotationType); if (annotation != null) { return annotation; } } else { Class<?> currentType = clazz; while (currentType != Object.class) { T annotation = currentType.getAnnotation(annotationType); if (annotation != null) { return annotation; } else { currentType = currentType.getSuperclass(); } } } for (Class<?> iface : clazz.getInterfaces()) { T annotation = iface.getAnnotation(annotationType); if (annotation != null) { return annotation; } } return null; }  abstract Class<? extends UI> getUIClass(UIClassSelectionEvent event); UI createInstance(UICreateEvent event); String getTheme(UICreateEvent event); @Deprecated String getWidgetset(UICreateEvent event); WidgetsetInfo getWidgetsetInfo(UICreateEvent event); boolean isPreservedOnRefresh(UICreateEvent event); String getPageTitle(UICreateEvent event); PushMode getPushMode(UICreateEvent event); Transport getPushTransport(UICreateEvent event); }
UIProvider implements Serializable { protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz, Class<T> annotationType) { if (annotationType.getAnnotation(Inherited.class) != null) { T annotation = clazz.getAnnotation(annotationType); if (annotation != null) { return annotation; } } else { Class<?> currentType = clazz; while (currentType != Object.class) { T annotation = currentType.getAnnotation(annotationType); if (annotation != null) { return annotation; } else { currentType = currentType.getSuperclass(); } } } for (Class<?> iface : clazz.getInterfaces()) { T annotation = iface.getAnnotation(annotationType); if (annotation != null) { return annotation; } } return null; }  abstract Class<? extends UI> getUIClass(UIClassSelectionEvent event); UI createInstance(UICreateEvent event); String getTheme(UICreateEvent event); @Deprecated String getWidgetset(UICreateEvent event); WidgetsetInfo getWidgetsetInfo(UICreateEvent event); boolean isPreservedOnRefresh(UICreateEvent event); String getPageTitle(UICreateEvent event); PushMode getPushMode(UICreateEvent event); Transport getPushTransport(UICreateEvent event);  }