/** * Find the @UsesContainer annotations. */ private void findUsesContainerAnnotations(Component component, String typeName) { try { Class<?> type = getTypeRepository().loadClass(typeName); UsesContainer[] annotations = type.getAnnotationsByType(UsesContainer.class); for (UsesContainer annotation : annotations) { String name = annotation.name(); String description = annotation.description(); String technology = annotation.technology(); Container container = findContainerByNameOrCanonicalName(component, name); if (container != null) { component.uses(container, description, technology); } else { log.warn("A container named \"" + name + "\" could not be found."); } } } catch (ClassNotFoundException e) { log.warn("Could not load type " + typeName); } }
/** * Finds @UsedByContainer annotations. */ private void findUsedByContainerAnnotations(Component component, String typeName) { try { Class<?> type = getTypeRepository().loadClass(typeName); UsedByContainer[] annotations = type.getAnnotationsByType(UsedByContainer.class); for (UsedByContainer annotation : annotations) { String name = annotation.name(); String description = annotation.description(); String technology = annotation.technology(); Container container = findContainerByNameOrCanonicalName(component, name); if (container != null) { container.uses(component, description, technology); } else { log.warn("A container named \"" + name + "\" could not be found."); } } } catch (ClassNotFoundException e) { log.warn("Could not load type " + typeName); } }