List of usage examples for com.google.common.base Predicates in
public static <T> Predicate<T> in(Collection<? extends T> target)
From source file:brooklyn.entity.nosql.cassandra.CassandraNodeImpl.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override// w ww .j a v a 2s .c o m protected void connectSensors() { // "cassandra" isn't really a protocol, but okay for now setAttribute(DATASTORE_URL, "cassandra://" + getAttribute(HOSTNAME) + ":" + getAttribute(THRIFT_PORT)); super.connectSensors(); jmxHelper = new JmxHelper(this); jmxFeed = JmxFeed.builder().entity(this).period(3000, TimeUnit.MILLISECONDS).helper(jmxHelper) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP_JMX).objectName(storageServiceMBean) .attributeName("Initialized").onSuccess(Functions.forPredicate(Predicates.notNull())) .onException(Functions.constant(false))) .pollAttribute(new JmxAttributePollConfig<Set<BigInteger>>(TOKENS).objectName(storageServiceMBean) .attributeName("TokenToEndpointMap").onSuccess(new Function<Object, Set<BigInteger>>() { @Override public Set<BigInteger> apply(@Nullable Object arg) { Map input = (Map) arg; if (input == null || input.isEmpty()) return null; // FIXME does not work on aws-ec2, uses RFC1918 address Predicate<String> self = Predicates .in(ImmutableList.of(getAttribute(HOSTNAME), getAttribute(ADDRESS), getAttribute(SUBNET_ADDRESS), getAttribute(SUBNET_HOSTNAME))); Set<String> tokens = Maps.filterValues(input, self).keySet(); Set<BigInteger> result = Sets.newLinkedHashSet(); for (String token : tokens) { result.add(new BigInteger(token)); } return result; } }).onException(Functions.<Set<BigInteger>>constant(null))) .pollAttribute(new JmxAttributePollConfig<BigInteger>(TOKEN).objectName(storageServiceMBean) .attributeName("TokenToEndpointMap").onSuccess(new Function<Object, BigInteger>() { @Override public BigInteger apply(@Nullable Object arg) { Map input = (Map) arg; // TODO remove duplication from setting TOKENS if (input == null || input.isEmpty()) return null; // FIXME does not work on aws-ec2, uses RFC1918 address Predicate<String> self = Predicates .in(ImmutableList.of(getAttribute(HOSTNAME), getAttribute(ADDRESS), getAttribute(SUBNET_ADDRESS), getAttribute(SUBNET_HOSTNAME))); Set<String> tokens = Maps.filterValues(input, self).keySet(); String token = Iterables.getFirst(tokens, null); return (token != null) ? new BigInteger(token) : null; } }).onException(Functions.<BigInteger>constant(null))) .pollOperation(new JmxOperationPollConfig<String>(DATACENTER_NAME).period(60, TimeUnit.SECONDS) .objectName(snitchMBean).operationName("getDatacenter") .operationParams(ImmutableList.of(getBroadcastAddress())) .onException(Functions.<String>constant(null))) .pollOperation(new JmxOperationPollConfig<String>(RACK_NAME).period(60, TimeUnit.SECONDS) .objectName(snitchMBean).operationName("getRack") .operationParams(ImmutableList.of(getBroadcastAddress())) .onException(Functions.<String>constant(null))) .pollAttribute(new JmxAttributePollConfig<Integer>(PEERS).objectName(storageServiceMBean) .attributeName("TokenToEndpointMap").onSuccess(new Function<Object, Integer>() { @Override public Integer apply(@Nullable Object arg) { Map input = (Map) arg; if (input == null || input.isEmpty()) return 0; return input.size(); } }).onException(Functions.constant(-1))) .pollAttribute(new JmxAttributePollConfig<Integer>(LIVE_NODE_COUNT).objectName(storageServiceMBean) .attributeName("LiveNodes").onSuccess(new Function<Object, Integer>() { @Override public Integer apply(@Nullable Object arg) { List input = (List) arg; if (input == null || input.isEmpty()) return 0; return input.size(); } }).onException(Functions.constant(-1))) .pollAttribute(new JmxAttributePollConfig<Integer>(READ_ACTIVE).objectName(readStageMBean) .attributeName("ActiveCount").onException(Functions.constant((Integer) null))) .pollAttribute(new JmxAttributePollConfig<Long>(READ_PENDING).objectName(readStageMBean) .attributeName("PendingTasks").onException(Functions.constant((Long) null))) .pollAttribute(new JmxAttributePollConfig<Long>(READ_COMPLETED).objectName(readStageMBean) .attributeName("CompletedTasks").onException(Functions.constant((Long) null))) .pollAttribute(new JmxAttributePollConfig<Integer>(WRITE_ACTIVE).objectName(mutationStageMBean) .attributeName("ActiveCount").onException(Functions.constant((Integer) null))) .pollAttribute(new JmxAttributePollConfig<Long>(WRITE_PENDING).objectName(mutationStageMBean) .attributeName("PendingTasks").onException(Functions.constant((Long) null))) .pollAttribute(new JmxAttributePollConfig<Long>(WRITE_COMPLETED).objectName(mutationStageMBean) .attributeName("CompletedTasks").onException(Functions.constant((Long) null))) .build(); functionFeed = FunctionFeed.builder().entity(this).period(3000, TimeUnit.MILLISECONDS) .poll(new FunctionPollConfig<Long, Long>(THRIFT_PORT_LATENCY) .onException(Functions.constant((Long) null)).callable(new Callable<Long>() { public Long call() { try { long start = System.currentTimeMillis(); Socket s = new Socket(getAttribute(Attributes.HOSTNAME), getThriftPort()); s.close(); long latency = System.currentTimeMillis() - start; computeServiceUp(); return latency; } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Cassandra thrift port poll failure: " + e); setAttribute(SERVICE_UP, false); return null; } } public void computeServiceUp() { // this will wait an additional poll period after thrift port is up, // as the caller will not have set yet, but that will help ensure it is really healthy! setAttribute(SERVICE_UP, getAttribute(THRIFT_PORT_LATENCY) != null && getAttribute(THRIFT_PORT_LATENCY) >= 0 && Boolean.TRUE.equals(getAttribute(SERVICE_UP_JMX))); } })) .build(); jmxMxBeanFeed = JavaAppUtils.connectMXBeanSensors(this); }
From source file:com.google.devtools.build.lib.rules.java.JavaTargetAttributes.java
/** * Returns the classpath artifacts needed in a deploy jar for this target. * * This excludes the artifacts made available by jars in the deployment * environment.//from w ww . j a va2s.c om */ public Iterable<Artifact> getRuntimeClassPathForArchive() { Iterable<Artifact> runtimeClasspath = getRuntimeClassPath(); if (getExcludedArtifacts().isEmpty()) { return runtimeClasspath; } else { return Iterables.filter(runtimeClasspath, Predicates.not(Predicates.in(getExcludedArtifacts().toSet()))); } }
From source file:org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.policy.ExecutionSelectionEditPolicy.java
private void addMessageReconnectionCommand(Execution self, CompositeTransactionalCommand cc, TransactionalEditingDomain editingDomain, Message message, Range newRange, ChangeBoundsRequest request, AbstractNodeEventResizeSelectionValidator validator) { Set<Execution> executionsInMove = new RequestQuery(request).getExecutions(); boolean invalidCommand = false; Predicate<EventEnd> filterCompoundEventEnd = new Predicate<EventEnd>() { @Override//from w w w . ja v a 2 s . co m public boolean apply(EventEnd input) { return input instanceof CompoundEventEnd; } }; SetMessageRangeOperation smrc = new SetMessageRangeOperation((Edge) message.getNotationView(), newRange); Lifeline selfLifeline = self.getLifeline().get(); Rectangle logicalDelta = new RequestQuery(request).getLogicalDelta(); Rectangle bounds = self.getProperLogicalBounds().getCopy(); bounds.translate(logicalDelta.getLocation()); bounds.resize(logicalDelta.getSize()); Range thisFinalRange = RangeHelper.verticalRange(bounds); List<ISequenceEvent> toIgnore = Lists.newArrayList(); boolean isReplyMessage = message.getKind() == Message.Kind.REPLY; boolean isReflective = message.isReflective(); ISequenceNode sourceElement = message.getSourceElement(); ISequenceNode targetElement = message.getTargetElement(); if (!isReplyMessage && isReflective && Iterables.any(EventEndHelper.findEndsFromSemanticOrdering(message), filterCompoundEventEnd) && targetElement == self) { // Avoid target of the return message of a reflexive sync call to // reconnect on its execution toIgnore.add(self); } // if a verticalSpaceExpansion will occurs, ignore ISequenceEvent under // the insertionPoint if (needVerticalSpaceExpansion(validator, request)) { Collection<ISequenceEvent> sequenceEventsUpperToInsertionTime = getSequenceEventsUpperToInsertionTime( self.getDiagram(), validator.getExpansionZone().getLowerBound()); sequenceEventsUpperToInsertionTime.removeAll(executionsInMove); toIgnore.addAll(sequenceEventsUpperToInsertionTime); } Option<Lifeline> srcLifeline = message.getSourceLifeline(); if (srcLifeline.some()) { EventFinder srcFinder = new EventFinder(srcLifeline.get()); srcFinder.setReconnection(true); srcFinder.setEventsToIgnore(Predicates.in(toIgnore)); srcFinder.setExpansionZone(validator.getExpansionZone()); ISequenceEvent finalSrc = (srcLifeline.get() == selfLifeline && sourceElement == self) ? self : srcFinder.findMostSpecificEvent(newRange); Range finalSrcRange = (srcLifeline.get() == selfLifeline && sourceElement == self) ? thisFinalRange : finalSrc.getVerticalRange(); smrc.setSource(finalSrc.getNotationView(), new Rectangle(0, finalSrcRange.getLowerBound(), 0, finalSrcRange.width())); } else { Range finalSrcRange = RangeHelper.verticalRange(sourceElement.getProperLogicalBounds()); smrc.setSource(sourceElement.getNotationView(), new Rectangle(0, finalSrcRange.getLowerBound(), 0, finalSrcRange.width())); } toIgnore.clear(); if (isReplyMessage && isReflective && Iterables.any(EventEndHelper.findEndsFromSemanticOrdering(message), filterCompoundEventEnd) && sourceElement == self) { // Avoid target of the return message of a reflexive sync call to // reconnect on its execution toIgnore.add(self); } // if a verticalSpaceExpansion will occurs, ignore ISequenceEvent under // the insertionPoint if (needVerticalSpaceExpansion(validator, request)) { Collection<ISequenceEvent> sequenceEventsUpperToInsertionTime = getSequenceEventsUpperToInsertionTime( self.getDiagram(), validator.getExpansionZone().getLowerBound()); sequenceEventsUpperToInsertionTime.removeAll(executionsInMove); toIgnore.addAll(sequenceEventsUpperToInsertionTime); } Option<Lifeline> tgtLifeline = message.getTargetLifeline(); if (tgtLifeline.some()) { EventFinder tgtFinder = new EventFinder(tgtLifeline.get()); tgtFinder.setReconnection(true); tgtFinder.setEventsToIgnore(Predicates.in(toIgnore)); tgtFinder.setExpansionZone(validator.getExpansionZone()); ISequenceEvent finalTgt = (tgtLifeline.get() == selfLifeline && targetElement == self) ? self : tgtFinder.findMostSpecificEvent(newRange); if (finalTgt == null) { invalidCommand = true; } else { Range finalTgtRange = (tgtLifeline.get() == selfLifeline && targetElement == self) ? thisFinalRange : finalTgt.getVerticalRange(); smrc.setTarget(finalTgt.getNotationView(), new Rectangle(0, finalTgtRange.getLowerBound(), 0, finalTgtRange.width())); } } else { Range finalTgtRange = RangeHelper.verticalRange(targetElement.getProperLogicalBounds()); smrc.setTarget(targetElement.getNotationView(), new Rectangle(0, finalTgtRange.getLowerBound(), 0, finalTgtRange.width())); } if (invalidCommand) { cc.compose(org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE); } else { cc.compose(CommandFactory.createICommand(editingDomain, smrc)); } }
From source file:org.apache.brooklyn.entity.nosql.cassandra.CassandraNodeImpl.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override/*from w w w . ja v a 2s . c om*/ protected void connectSensors() { // "cassandra" isn't really a protocol, but okay for now sensors().set(DATASTORE_URL, "cassandra://" + getAttribute(HOSTNAME) + ":" + getAttribute(THRIFT_PORT)); super.connectSensors(); jmxHelper = new JmxHelper(this); boolean retrieveUsageMetrics = getConfig(RETRIEVE_USAGE_METRICS); if (getDriver().isJmxEnabled()) { jmxFeed = JmxFeed.builder().entity(this).period(3000, TimeUnit.MILLISECONDS).helper(jmxHelper) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP_JMX) .objectName(storageServiceMBean).attributeName("Initialized") .onSuccess(Functions.forPredicate(Predicates.notNull())) .onException(Functions.constant(false)).suppressDuplicates(true)) .pollAttribute(new JmxAttributePollConfig<Set<BigInteger>>(TOKENS) .objectName(storageServiceMBean).attributeName("TokenToEndpointMap") .onSuccess(new Function<Object, Set<BigInteger>>() { @Override public Set<BigInteger> apply(@Nullable Object arg) { Map input = (Map) arg; if (input == null || input.isEmpty()) return null; // FIXME does not work on aws-ec2, uses RFC1918 address Predicate<String> self = Predicates .in(ImmutableList.of(getAttribute(HOSTNAME), getAttribute(ADDRESS), getAttribute(SUBNET_ADDRESS), getAttribute(SUBNET_HOSTNAME))); Set<String> tokens = Maps.filterValues(input, self).keySet(); Set<BigInteger> result = Sets.newLinkedHashSet(); for (String token : tokens) { result.add(new BigInteger(token)); } return result; } }).onException(Functions.<Set<BigInteger>>constant(null)).suppressDuplicates(true)) .pollOperation(new JmxOperationPollConfig<String>(DATACENTER_NAME).period(60, TimeUnit.SECONDS) .objectName(snitchMBean).operationName("getDatacenter") .operationParams(ImmutableList.of(getBroadcastAddress())) .onException(Functions.<String>constant(null)).suppressDuplicates(true)) .pollOperation(new JmxOperationPollConfig<String>(RACK_NAME).period(60, TimeUnit.SECONDS) .objectName(snitchMBean).operationName("getRack") .operationParams(ImmutableList.of(getBroadcastAddress())) .onException(Functions.<String>constant(null)).suppressDuplicates(true)) .pollAttribute(new JmxAttributePollConfig<Integer>(PEERS).objectName(storageServiceMBean) .attributeName("TokenToEndpointMap").onSuccess(new Function<Object, Integer>() { @Override public Integer apply(@Nullable Object arg) { Map input = (Map) arg; if (input == null || input.isEmpty()) return 0; return input.size(); } }).onException(Functions.constant(-1))) .pollAttribute( new JmxAttributePollConfig<Integer>(LIVE_NODE_COUNT).objectName(storageServiceMBean) .attributeName("LiveNodes").onSuccess(new Function<Object, Integer>() { @Override public Integer apply(@Nullable Object arg) { List input = (List) arg; if (input == null || input.isEmpty()) return 0; return input.size(); } }).onException(Functions.constant(-1))) .pollAttribute(new JmxAttributePollConfig<Integer>(READ_ACTIVE).objectName(readStageMBean) .attributeName("ActiveCount").onException(Functions.constant((Integer) null)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(READ_PENDING).objectName(readStageMBean) .attributeName("PendingTasks").onException(Functions.constant((Long) null)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(READ_COMPLETED).objectName(readStageMBean) .attributeName("CompletedTasks").onException(Functions.constant((Long) null)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Integer>(WRITE_ACTIVE).objectName(mutationStageMBean) .attributeName("ActiveCount").onException(Functions.constant((Integer) null)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(WRITE_PENDING).objectName(mutationStageMBean) .attributeName("PendingTasks").onException(Functions.constant((Long) null)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(WRITE_COMPLETED).objectName(mutationStageMBean) .attributeName("CompletedTasks").onException(Functions.constant((Long) null)) .enabled(retrieveUsageMetrics)) .build(); jmxMxBeanFeed = JavaAppUtils.connectMXBeanSensors(this); } if (Boolean.TRUE.equals(getConfig(USE_THRIFT_MONITORING))) { functionFeed = FunctionFeed.builder().entity(this).period(3000, TimeUnit.MILLISECONDS) .poll(new FunctionPollConfig<Long, Long>(THRIFT_PORT_LATENCY) .onException(Functions.constant(-1L)) .callable(new ThriftLatencyChecker(CassandraNodeImpl.this)) .enabled(retrieveUsageMetrics)) .build(); } connectServiceUpIsRunning(); }
From source file:org.caleydo.view.bicluster.elem.GLRootElement.java
public void addMultiAnnotation(EDimension dim, TablePerspective t) { final IDType annotateTo = clustering.getIDType(dim); final IDMappingManagerRegistry registry = IDMappingManagerRegistry.get(); // record of annotation to gene/samples final ATableBasedDataDomain d = t.getDataDomain(); final Table table = d.getTable(); final IDType go = t.getRecordPerspective().getIdType(); final IDMappingManager m = registry.getIDMappingManager(annotateTo); IIDTypeMapper<Integer, Integer> rec2annotateTo = m.getIDTypeMapper(go, annotateTo); IDType goLabel = rec2annotateTo.getPath().get(0).getToIDType(); IIDTypeMapper<Integer, String> rec2label = m.getIDTypeMapper(go, goLabel); for (NormalClusterElement cluster : allNormalClusters()) { Integer col = cluster.getBiClusterNumber(); List<Integer> records = findBestColumns(col, t); if (records.isEmpty()) continue; for (Integer record : records) { float pValue = ((Number) table.getRaw(col, record)).floatValue(); Set<Integer> containedGenes = containedGenes(record, rec2annotateTo); if (containedGenes == null || containedGenes.isEmpty()) continue; final Set<String> labels = rec2label.apply(record); String label = labels == null ? record.toString() : (labels.size() == 1 ? labels.iterator().next().toString() : StringUtils.join(labels, ", ")); cluster.addAnnotation(new GoLZHeatmapElement(dim, label, pValue, Predicates.in(containedGenes), d)); }//from w w w.j av a 2s . com } }
From source file:com.eucalyptus.compute.vpc.VpcManager.java
public CreateDhcpOptionsResponseType createDhcpOptions(final CreateDhcpOptionsType request) throws EucalyptusCloudException { final CreateDhcpOptionsResponseType reply = request.getReply(); final Context ctx = Contexts.lookup(); final Supplier<DhcpOptionSet> allocator = new Supplier<DhcpOptionSet>() { @Override//from ww w .jav a 2 s. c om public DhcpOptionSet get() { try { final DhcpOptionSet dhcpOptionSet = DhcpOptionSet.create(ctx.getUserFullName(), Identifier.dopt.generate()); for (final DhcpConfigurationItemType item : request.getDhcpConfigurationSet().getItem()) { final List<String> values = item.values(); boolean validValue = false; out: switch (item.getKey()) { case DhcpOptionSets.DHCP_OPTION_DOMAIN_NAME: validValue = values.size() == 1 && InternetDomainName.isValid(values.get(0)); break; case DhcpOptionSets.DHCP_OPTION_DOMAIN_NAME_SERVERS: validValue = values.size() == 1 && "AmazonProvidedDNS".equals(values.get(0)); if (validValue) break; // else fallthrough case DhcpOptionSets.DHCP_OPTION_NTP_SERVERS: // fallthrough case DhcpOptionSets.DHCP_OPTION_NETBIOS_NAME_SERVERS: for (final String value : values) { validValue = InetAddresses.isInetAddress(value); if (!validValue) break out; } break; case DhcpOptionSets.DHCP_OPTION_NETBIOS_NODE_TYPE: validValue = values.size() == 1 && Optional.fromNullable(Ints.tryParse(values.get(0))) .transform( Functions.forPredicate(Predicates.in(Lists.newArrayList(1, 2, 4, 8)))) .or(false); break; default: throw new ClientComputeException("InvalidParameterValue", "Value (" + item.getKey() + ") for parameter name is invalid. Unknown DHCP option"); } if (!validValue || values.isEmpty()) { throw new ClientComputeException("InvalidParameterValue", "Value (" + Joiner.on(',').join(values) + ") for parameter value is invalid. Invalid DHCP option value."); } dhcpOptionSet.getDhcpOptions() .add(DhcpOption.create(dhcpOptionSet, item.getKey(), item.values())); } return dhcpOptionSets.save(dhcpOptionSet); } catch (Exception ex) { throw Exceptions.toUndeclared(ex); } } }; reply.setDhcpOptions(allocate(allocator, DhcpOptionSet.class, DhcpOptionsType.class)); return reply; }
From source file:com.palantir.atlasdb.transaction.impl.SerializableTransaction.java
private NavigableMap<Cell, byte[]> getReadsInRange(String table, Entry<RangeRequest, byte[]> e, RangeRequest range) {/*from w ww .ja v a 2 s . co m*/ NavigableMap<Cell, byte[]> reads = getReadsForTable(table); if (range.getStartInclusive().length != 0) { reads = reads.tailMap(Cells.createSmallestCellForRow(range.getStartInclusive()), true); } if (range.getEndExclusive().length != 0) { reads = reads.headMap(Cells.createSmallestCellForRow(range.getEndExclusive()), false); } ConcurrentNavigableMap<Cell, byte[]> writes = writesByTable.get(table); if (writes != null) { reads = Maps.filterKeys(reads, Predicates.not(Predicates.in(writes.keySet()))); } return reads; }
From source file:com.google.devtools.build.lib.rules.objc.ProtobufSupport.java
private Iterable<Artifact> getProtoSourceFilesForCompilation(Iterable<Artifact> outputProtoFiles) { Iterable<Artifact> filteredOutputs = Iterables.filter(outputProtoFiles, Predicates.not(Predicates.in(dylibHandledProtos))); return getGeneratedProtoOutputs(filteredOutputs, SOURCE_SUFFIX); }
From source file:com.google.gwt.resources.rg.GssResourceGenerator.java
private Map<String, String> doClassRenaming(CssTree cssTree, JMethod method, TreeLogger logger, ResourceContext context) throws UnableToCompleteException { Map<String, Map<String, String>> replacementsWithPrefix = computeReplacements(method, logger, context); Set<String> externalClasses = collectExternalClasses(cssTree); RenamingSubstitutionMap substitutionMap = new RenamingSubstitutionMap(replacementsWithPrefix, externalClasses, isStrictResource(method), logger); new CssClassRenaming(cssTree.getMutatingVisitController(), substitutionMap, null).runPass(); if (substitutionMap.hasError()) { throw new UnableToCompleteException(); }/* w w w .j a v a 2 s. c om*/ Map<String, String> mapping = replacementsWithPrefix.get(""); mapping = Maps.newHashMap(Maps.filterKeys(mapping, Predicates.in(substitutionMap.getStyleClasses()))); // add external classes in the mapping for (String external : externalClasses) { mapping.put(external, external); } return mapping; }
From source file:dagger2.internal.codegen.BindingGraphValidator.java
private void validateBuilders(BindingGraph subject, Builder<BindingGraph> reportBuilder) { ComponentDescriptor componentDesc = subject.componentDescriptor(); if (!componentDesc.builderSpec().isPresent()) { // If no builder, nothing to validate. return;/*ww w .j a v a 2 s . c om*/ } Set<TypeElement> allDependents = Sets.union( Sets.union(subject.transitiveModules().keySet(), componentDesc.dependencies()), componentDesc.executorDependency().asSet()); Set<TypeElement> requiredDependents = Sets.filter(allDependents, new Predicate<TypeElement>() { @Override public boolean apply(TypeElement input) { return !Util.componentCanMakeNewInstances(input); } }); final BuilderSpec spec = componentDesc.builderSpec().get(); Map<TypeElement, ExecutableElement> allSetters = spec.methodMap(); ErrorMessages.ComponentBuilderMessages msgs = ErrorMessages .builderMsgsFor(subject.componentDescriptor().kind()); Set<TypeElement> extraSetters = Sets.difference(allSetters.keySet(), allDependents); if (!extraSetters.isEmpty()) { Collection<ExecutableElement> excessMethods = Maps.filterKeys(allSetters, Predicates.in(extraSetters)) .values(); Iterable<String> formatted = FluentIterable.from(excessMethods) .transform(new Function<ExecutableElement, String>() { @Override public String apply(ExecutableElement input) { return methodSignatureFormatter.format(input, Optional.of(MoreTypes.asDeclared(spec.builderDefinitionType().asType()))); } }); reportBuilder.addItem(String.format(msgs.extraSetters(), formatted), spec.builderDefinitionType()); } Set<TypeElement> missingSetters = Sets.difference(requiredDependents, allSetters.keySet()); if (!missingSetters.isEmpty()) { reportBuilder.addItem(String.format(msgs.missingSetters(), missingSetters), spec.builderDefinitionType()); } }