private ImmutableSet<? extends Class<? extends Annotation>> getSupportedAnnotationClasses() { checkState(steps != null); ImmutableSet.Builder<Class<? extends Annotation>> builder = ImmutableSet.builder(); for (ProcessingStep step : steps) { builder.addAll(step.annotations()); } return builder.build(); }
/** Processes the valid elements, including those previously deferred by each step. */ private void process(ImmutableSetMultimap<Class<? extends Annotation>, Element> validElements) { for (ProcessingStep step : steps) { ImmutableSetMultimap<Class<? extends Annotation>, Element> stepElements = new ImmutableSetMultimap.Builder<Class<? extends Annotation>, Element>() .putAll(indexByAnnotation(elementsDeferredBySteps.get(step))) .putAll(filterKeys(validElements, Predicates.<Object>in(step.annotations()))) .build(); if (stepElements.isEmpty()) { elementsDeferredBySteps.removeAll(step); } else { Set<? extends Element> rejectedElements = step.process(stepElements); elementsDeferredBySteps.replaceValues( step, transform( rejectedElements, new Function<Element, ElementName>() { @Override public ElementName apply(Element element) { return ElementName.forAnnotatedElement(element); } })); } } }