List of usage examples for com.google.common.collect SetMultimap values
Collection<V> values();
From source file:org.inferred.freebuilder.processor.MethodFinder.java
/** * Returns all methods, declared and inherited, on {@code type}, except those specified by * {@link Object}./*from w w w.j av a2 s . co m*/ * * <p>If method B overrides method A, only method B will be included in the return set. * Additionally, if methods A and B have the same signature, but are on unrelated interfaces, * one will be arbitrarily picked to be returned. */ public static ImmutableSet<ExecutableElement> methodsOn(TypeElement type, Elements elements) throws CannotGenerateCodeException { TypeElement objectType = elements.getTypeElement(Object.class.getCanonicalName()); SetMultimap<Signature, ExecutableElement> methods = LinkedHashMultimap.create(); for (TypeElement supertype : getSupertypes(type)) { for (ExecutableElement method : methodsIn(supertype.getEnclosedElements())) { if (method.getEnclosingElement().equals(objectType)) { continue; // Skip methods specified by Object. } Signature signature = new Signature(method); Iterator<ExecutableElement> iterator = methods.get(signature).iterator(); while (iterator.hasNext()) { ExecutableElement otherMethod = iterator.next(); if (elements.overrides(method, otherMethod, type) || method.getParameters().equals(otherMethod.getParameters())) { iterator.remove(); } } methods.put(signature, method); } } return ImmutableSet.copyOf(methods.values()); }
From source file:dagger.internal.codegen.MultibindingsProcessingStep.java
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) { for (TypeElement element : typesIn(elementsByAnnotation.values())) { multibindingsValidator.validate(element).printMessagesTo(messager); }//from ww w . j a v a 2 s. co m return ImmutableSet.of(); }
From source file:dagger.internal.codegen.MonitoringModuleProcessingStep.java
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation, boolean anyElementsRejected) { for (Element element : elementsByAnnotation.values()) { monitoringModuleGenerator.generate(MoreElements.asType(element), messager); }/*ww w. j av a2s . c om*/ return ImmutableSet.of(); }
From source file:dagger.internal.codegen.ProductionExecutorModuleProcessingStep.java
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation, boolean anyElementsRejected) { for (Element element : elementsByAnnotation.values()) { productionExecutorModuleGenerator.generate(MoreElements.asType(element), messager); }//from w w w .j av a2s . c o m return ImmutableSet.of(); }
From source file:dagger.internal.codegen.BindingMethodProcessingStep.java
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation, boolean anyElementsRejected) { for (ExecutableElement method : methodsIn(elementsByAnnotation.values())) { checkArgument(anyBindingMethodValidator.isBindingMethod(method), "%s is not annotated with any of %s", method, annotations());//from w w w. j av a2 s .c om if (!anyBindingMethodValidator.wasAlreadyValidated(method)) { anyBindingMethodValidator.validate(method).printMessagesTo(messager); } } return ImmutableSet.of(); }
From source file:exm.stc.ic.opt.WaitCoalescer.java
/** * Update waiter map by removing continuations and instructions * based on object identity//from www .j ava 2 s. com * @param waitMap * @param removedC * @param removedI */ private static void updateWaiterMap(SetMultimap<Var, InstOrCont> waitMap, Set<Continuation> removedC, Set<Instruction> removedI) { Iterator<InstOrCont> it = waitMap.values().iterator(); while (it.hasNext()) { InstOrCont ic = it.next(); switch (ic.type()) { case CONTINUATION: if (removedC.contains(ic.continuation())) { it.remove(); } break; case INSTRUCTION: if (removedI.contains(ic.instruction())) { it.remove(); } break; default: throw new STCRuntimeError("shouldn't get here, unexpected enum " + ic.type()); } } }
From source file:dagger.android.processor.ContributesAndroidInjectorGenerator.java
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation) { for (ExecutableElement method : ElementFilter.methodsIn(elementsByAnnotation.values())) { validator.createIfValid(method).ifPresent(this::generate); }// w w w .j a va 2 s . c o m return ImmutableSet.of(); }
From source file:org.n52.javaps.coding.stream.AbstractSimilarityKeyRepository.java
protected void setProducers(SetMultimap<K, Producer<C>> implementations) { this.componentsByKey.clear(); this.componentsByKey.putAll(implementations); this.components.clear(); this.components.addAll(implementations.values()); }
From source file:dagger.internal.codegen.ModuleProcessingStep.java
@Override public Set<Element> process(SetMultimap<Class<? extends Annotation>, Element> elementsByAnnotation, boolean anyElementsRejected) { List<TypeElement> modules = typesIn(elementsByAnnotation.values()); moduleValidator.addKnownModules(modules); for (TypeElement module : modules) { if (processedModuleElements.add(module)) { processModule(module);/* ww w.j av a 2s. c o m*/ } } return ImmutableSet.of(); }
From source file:org.jboss.errai.validation.rebind.GwtValidatorGenerator.java
private Set<Class<?>> extractValidationGroups(SetMultimap<MetaClass, Annotation> validationConfig) { Set<Class<?>> groups = new HashSet<Class<?>>(); for (Annotation annotation : validationConfig.values()) { try {//from w w w . jav a 2s . com Method method = annotation.getClass().getMethod("groups", (Class<?>[]) null); Class<?>[] ret = (Class<?>[]) method.invoke(annotation, (Object[]) null); if (ret.length != 0) { groups.addAll(Arrays.asList(ret)); } else { groups.add(Default.class); } } catch (NoSuchMethodException e) { throw new RuntimeException("Error finding groups() parameter in " + annotation.getClass().getName(), e); } catch (InvocationTargetException e) { throw new RuntimeException( "Error invoking groups() parameter in " + annotation.getClass().getName(), e); } catch (IllegalAccessException e) { throw new RuntimeException( "Error invoking groups() parameter in " + annotation.getClass().getName(), e); } } return groups; }