@Test public void testSimpleMetaDataTreeWithMetaData() { this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class); ViewConfigNode node = this.viewConfigExtension.findNode(SimplePageConfig002.class); Assert.assertNotNull(node); Assert.assertNotNull(node.getParent()); Assert.assertNull(node.getParent().getParent()); Assert.assertNotNull(node.getChildren()); Assert.assertEquals(0, node.getChildren().size()); Assert.assertNotNull(node.getMetaData()); Assert.assertEquals(1, node.getMetaData().size()); Assert.assertNotNull(node.getInheritedMetaData()); Assert.assertEquals(0, node.getInheritedMetaData().size()); }
private ViewConfigNode findNodeWithClass(Class nodeClass, ViewConfigNode viewConfigNode) { if (viewConfigNode == null || nodeClass == null) { return null; } if (nodeClass.equals(viewConfigNode.getSource())) { return viewConfigNode; } return findNodeWithClass(nodeClass, viewConfigNode.getParent()); }
protected List<Annotation> findViewMetaData(Class currentClass, ViewConfigNode viewConfigNode) { // don't include meta-data from the node itself, because it would be stored as inherited // meta-data if (currentClass.equals(viewConfigNode.getSource())) { return Collections.emptyList(); } List<Annotation> result = new ArrayList<Annotation>(); for (Annotation annotation : currentClass.getAnnotations()) { Class<? extends Annotation> annotationClass = annotation.annotationType(); if (annotationClass.getName().startsWith("java")) { continue; } addViewMetaData(annotation, result); } result = tryToReplaceWithMergedMetaDataFromAncestor( currentClass, viewConfigNode.getParent(), result); return result; }