List of usage examples for com.google.common.base Predicates notNull
@GwtCompatible(serializable = true) public static <T> Predicate<T> notNull()
From source file:com.netxforge.scoping.AbstractDynamixCDOResourceDescriptions.java
/** * Note as our cache will be initially empty, this will not return anything * unless//from w ww .j a va2 s . c om */ public Iterable<IResourceDescription> getAllResourceDescriptions() { List<URI> uris = this.resourceDescriptionCache.getKeys(); return Iterables.filter(Iterables.transform(uris, new Function<URI, IResourceDescription>() { public IResourceDescription apply(URI from) { return getResourceDescription(from); } }), Predicates.notNull()); }
From source file:net.shibboleth.idp.attribute.resolver.spring.dc.impl.DataConnectorFactoryBean.java
/** * The resources to use./*from ww w. j av a2 s . c o m*/ * * @param theResources the resources to look at */ public void setResources(@Nonnull @NonnullElements final List<Resource> theResources) { resources = ImmutableList.<Resource>builder().addAll(Iterables.filter(theResources, Predicates.notNull())) .build(); }
From source file:com.isotrol.impe3.web20.impl.AbstractEventManager.java
private Iterable<String> getAggregations(EventDTO event) { Set<String> set = event.getAggregations(); if (set == null) { return ImmutableSet.of(); }//from w w w .j a v a2 s. c o m return Iterables.filter(set, Predicates.notNull()); }
From source file:org.apache.jackrabbit.oak.security.principal.PrincipalProviderImpl.java
@Nonnull @Override//from w w w . j a va 2s . c om public Iterator<? extends Principal> findPrincipals(@Nullable final String nameHint, final int searchType) { try { Iterator<Authorizable> authorizables = findAuthorizables(nameHint, searchType); Iterator<Principal> principals = Iterators.transform( Iterators.filter(authorizables, Predicates.notNull()), new AuthorizableToPrincipal()); if (matchesEveryone(nameHint, searchType)) { principals = Iterators.concat(principals, Iterators.singletonIterator(EveryonePrincipal.getInstance())); return Iterators.filter(principals, new EveryonePredicate()); } else { return principals; } } catch (RepositoryException e) { log.debug(e.getMessage()); return Iterators.emptyIterator(); } }
From source file:gg.uhc.uhc.modules.team.requests.RequestManager.java
/** * Removes the request and processes the response * * @param id the id of the request/*from w w w . j a v a 2s . c om*/ * @param accepted the state to set * @return true if id existed, false otherwise */ public boolean finalizeRequest(int id, AcceptState accepted) { Optional<TeamRequest> optional = removeRequest(id); if (!optional.isPresent()) return false; TeamRequest request = optional.get(); Map<String, Object> context = ImmutableMap.<String, Object>builder().put("name", request.getOwnerName()) .put("id", request.getId()).put("members", Joiner.on(", ").join(request.getOthers())).build(); broadcast(messages.evalTemplate("on." + accepted.name().toLowerCase() + ".broadcast", context)); Player player = Bukkit.getPlayer(request.getOwner()); if (player != null) { player.sendMessage(messages.evalTemplate("on." + accepted.name().toLowerCase() + ".notify", context)); } if (accepted == AcceptState.ACCEPT) { Iterable<OfflinePlayer> players = Iterables.filter( Iterables.transform(request.getOthers(), FunctionalUtil.OFFLINE_PLAYER_FROM_NAME), Predicates.notNull()); Optional<Team> potentialTeam = module.findFirstEmptyTeam(); if (!potentialTeam.isPresent()) { broadcast(messages.getRaw("no empty teams")); return true; } Team team = potentialTeam.get(); for (OfflinePlayer p : players) { team.addPlayer(p); } team.addPlayer(Bukkit.getOfflinePlayer(request.getOwner())); } // otherwise do nothing return true; }
From source file:net.shibboleth.idp.saml.attribute.principalconnector.impl.PrincipalConnector.java
/** * Set the supported relying parties.//from ww w. j a v a2 s .c o m * * @param rps the supported relying parties */ public void setRelyingParties(@Nullable @NullableElements final Collection<String> rps) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); if (null != rps) { relyingParties = ImmutableSet.copyOf(Iterables.filter(rps, Predicates.notNull())); } }
From source file:org.opensaml.storage.impl.client.LoadClientStorageServices.java
/** * Set the {@link ClientStorageService} instances to check for loading. * /*from w ww . j a va 2s. c o m*/ * @param services instances to check for loading */ public void setStorageServices(@Nonnull @NonnullElements final Collection<ClientStorageService> services) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isNotNull(services, "StorageService collection cannot be null"); storageServices = new HashMap<>(services.size()); for (final ClientStorageService ss : Collections2.filter(services, Predicates.notNull())) { storageServices.put(ss.getStorageName(), ss); } }
From source file:net.shibboleth.idp.authn.impl.X500SubjectCanonicalization.java
/** * Set the subjectAltName types to search for, in order of preference. * //from ww w. j a va 2 s.c om * @param types types to search for */ public void setSubjectAltNameTypes(@Nonnull @NonnullElements final List<Integer> types) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isNotNull(types, "Type list cannot be null"); subjectAltNameTypes = new ArrayList<>(Collections2.filter(types, Predicates.notNull())); }
From source file:org.opensaml.saml.metadata.resolver.impl.AbstractBatchMetadataResolver.java
/** * Set the configured indexes./*from w ww.j a v a 2 s . c o m*/ * * @param newIndexes the new indexes to set */ public void setIndexes(@Nullable final Set<MetadataIndex> newIndexes) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); if (newIndexes == null) { indexes = Collections.emptySet(); } else { indexes = new HashSet<>(Collections2.filter(newIndexes, Predicates.notNull())); } }
From source file:org.apache.gobblin.metrics.event.sla.SlaEventSubmitter.java
/** * Submit the sla event by calling {@link SlaEventSubmitter#EventSubmitter#submit()}. If * {@link SlaEventSubmitter#eventName}, {@link SlaEventSubmitter#eventSubmitter}, {@link SlaEventSubmitter#datasetUrn} * are not available the method is a no-op. */// w w w.j av a 2 s . com public void submit() { try { Preconditions.checkArgument(Predicates.notNull().apply(eventSubmitter), "EventSubmitter needs to be set"); Preconditions.checkArgument(NOT_NULL_OR_EMPTY_PREDICATE.apply(eventName), "Eventname is required"); Preconditions.checkArgument(NOT_NULL_OR_EMPTY_PREDICATE.apply(datasetUrn), "DatasetUrn is required"); eventSubmitter.submit(eventName, buildEventMap()); } catch (IllegalArgumentException e) { log.info("Required arguments to submit an SLA event is not available. No Sla event will be submitted. " + e.toString()); } }