public Set<ControllerContext> getContexts(Class<?> clazz, ControllerState state) { lockRead(); try { Set<ControllerContext> contexts = new HashSet<ControllerContext>(); Set<ControllerContext> currentContexts = super.getContexts(clazz, state); if (currentContexts != null && currentContexts.size() > 0) { contexts.addAll(currentContexts); } AbstractController parentController = getParentController(); if (parentController != null) { Set<ControllerContext> parentContexts = parentController.getContexts(clazz, state); if (parentContexts != null && parentContexts.size() > 0) { contexts.addAll(parentContexts); } } return contexts.size() > 0 ? contexts : null; } finally{ unlockRead(); } }
/** * Get all contexts by name, * check child controllers as well. * * @param name the name of the context * @param contexts found contexts */ protected void getContexts(Object name, Set<ControllerContext> contexts) { ControllerContext context = getContext(name, null); if (context != null) { Set<Object> aliases = context.getAliases(); // only pick up unique name // TODO also ignore alises from @Aliases? if (aliases == null || aliases.contains(name) == false) contexts.add(context); } Set<AbstractController> children = getControllers(); if (children != null && children.isEmpty() == false) { for (AbstractController child : children) { child.getContexts(name, contexts); } } }
getContexts(item.getName(), dependents); if (dependents.isEmpty() == false)