List of usage examples for com.google.common.base Predicates notNull
@GwtCompatible(serializable = true) public static <T> Predicate<T> notNull()
From source file:net.shibboleth.idp.attribute.resolver.ad.mapped.impl.MappedAttributeDefinition.java
/** * Sets the functions used to map an input value to an output value. * /*from w w w. j a v a 2 s .c o m*/ * @param mappings functions used to map an input value to an output value */ public void setValueMaps(@Nullable @NullableElements final Collection<ValueMap> mappings) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); valueMaps = ImmutableSet.copyOf(Iterables.filter(mappings, Predicates.notNull())); }
From source file:com.spectralogic.ds3cli.command.GetDetailedObjects.java
private Predicate<DetailedS3Object> getSizePredicate() { if (Guard.isMapNullOrEmpty(this.filterParams)) { return Predicates.notNull(); }/*from w w w .j a v a 2s . c o m*/ final String larger = this.filterParams.get(LARGERTHAN); final String smaller = this.filterParams.get(SMALLERTHAN); if (Guard.isStringNullOrEmpty(larger) && Guard.isStringNullOrEmpty(smaller)) { return Predicates.notNull(); } // if one is specified, use default value for other final long largerthan = Guard.isStringNullOrEmpty(larger) ? 0L : Long.parseLong(larger); final long smallerthan = Guard.isStringNullOrEmpty(smaller) ? Long.MAX_VALUE : Long.parseLong(smaller); return new Predicate<DetailedS3Object>() { @Override public boolean apply(@Nullable final DetailedS3Object input) { return input.getSize() > largerthan && input.getSize() < smallerthan; } }; }
From source file:org.opensaml.saml.common.profile.logic.EntityAttributesPredicate.java
/** * Constructor./* w ww . j a va 2 s . c om*/ * * @param candidates the {@link Candidate} criteria to check for * @param trim true iff the values found in the metadata should be trimmed before comparison */ public EntityAttributesPredicate(@Nonnull @NonnullElements final Collection<Candidate> candidates, final boolean trim) { Constraint.isNotNull(candidates, "Attribute collection cannot be null"); candidateSet = new ArrayList<>(Collections2.filter(candidates, Predicates.notNull())); trimTags = trim; matchAll = false; }
From source file:net.shibboleth.idp.authn.config.MockAuthenticationProfileConfiguration.java
/** * Set the default authentication methods to use, expressed as custom principals. * /* ww w . j a v a 2 s. co m*/ * @param methods default authentication methods to use */ public void setDefaultAuthenticationMethods(@Nonnull @NonnullElements final List<Principal> methods) { Constraint.isNotNull(methods, "List of methods cannot be null"); defaultAuthenticationMethods = new ArrayList<>(Collections2.filter(methods, Predicates.notNull())); }
From source file:org.polarsys.reqcycle.repository.ui.providers.DummyInputContentProvider.java
@Override public Object[] getChildren(final Object object) { if (object instanceof DummyInput) { Object[] children = Collections2 .transform(((DummyInput) object).getInput(), new Function<RequirementSource, DummyObject>() { @Override//www. j av a 2 s .co m public DummyObject apply(RequirementSource reqSource) { return new DummyObject(((DummyInput) object).getPredicate(), reqSource); }; }).toArray(); return children; } if (object instanceof DummyObject) { final DummyObject dummyObject = (DummyObject) object; EObject obj = dummyObject.getEobj(); Collection<AbstractElement> elements = Collections.emptyList(); if (obj instanceof RequirementSource) { elements = ((RequirementSource) obj).getRequirements(); } if (obj instanceof Section) { elements = ((Section) obj).getChildren(); } Collection<DummyObject> transform = Collections2.transform(elements, new Function<EObject, DummyObject>() { @Override public DummyObject apply(EObject eObj) { IPredicate predicate = dummyObject.getPredicate(); DummyObject dObj = new DummyObject(predicate, eObj); if (dObj.getEobj() instanceof Section && !(dObj.getEobj() instanceof SimpleRequirement)) { return dObj; // do not use predicate filter for // sections which are not // requirements } if (predicate != null) { return predicate.match(eObj) ? dObj : null; } else { return dObj; } } }); Iterable<DummyObject> result = Iterables.filter(transform, Predicates.notNull()); return Iterables.toArray(result, DummyObject.class); } return super.getChildren(object); }
From source file:de.metas.ui.web.pickingV2.packageable.PackageableRow.java
private static LocalDateTime calculateEarliestPreparationTime(final Collection<Packageable> packageables) { return packageables.stream().map(Packageable::getPreparationDate).filter(Predicates.notNull()) .min(LocalDateTime::compareTo).orElse(null); }
From source file:org.vclipse.vcml.utils.SimplifyingVcmlUtils.java
public Statement mkSimplifiedCompoundStatement(final SimpleStatement... statements) { Iterable<SimpleStatement> statementsNonNull = Iterables.filter(Lists.newArrayList(statements), Predicates.notNull()); switch (Iterables.size(statementsNonNull)) { case 0:/*from ww w . jav a 2 s. c o m*/ return null; case 1: return Iterables.getFirst(statementsNonNull, null); default: final CompoundStatement compoundStatement = mkCompoundStatement(); compoundStatement.getStatements().addAll(Lists.newArrayList(statementsNonNull)); return compoundStatement; } }
From source file:org.apache.druid.query.groupby.epinephelinae.GroupByMergingQueryRunnerV2.java
public GroupByMergingQueryRunnerV2(GroupByQueryConfig config, ExecutorService exec, QueryWatcher queryWatcher, Iterable<QueryRunner<Row>> queryables, int concurrencyHint, BlockingPool<ByteBuffer> mergeBufferPool, int mergeBufferSize, ObjectMapper spillMapper, String processingTmpDir) { this.config = config; this.exec = MoreExecutors.listeningDecorator(exec); this.queryWatcher = queryWatcher; this.queryables = Iterables.unmodifiableIterable(Iterables.filter(queryables, Predicates.notNull())); this.concurrencyHint = concurrencyHint; this.mergeBufferPool = mergeBufferPool; this.spillMapper = spillMapper; this.processingTmpDir = processingTmpDir; this.mergeBufferSize = mergeBufferSize; }
From source file:org.incode.eurocommercial.contactapp.app.rest.v1.contacts.ContactableViewModel.java
/** * For searching by the filter bar./*from w ww. j a v a 2 s . c om*/ * @return */ @XmlTransient public String getContactRoleNames() { return Joiner.on(";").join(FluentIterable.from(getContactRoles()).transform(ContactRoleViewModel.nameOf()) .filter(Predicates.notNull())); }
From source file:net.shibboleth.idp.saml.profile.config.saml1.BrowserSSOProfileConfiguration.java
/** * Set the default authentication methods to use, expressed as custom principals. * //from w ww . ja va2s. c o m * @param methods default authentication methods to use */ public void setDefaultAuthenticationMethods( @Nonnull @NonnullElements final List<AuthenticationMethodPrincipal> methods) { Constraint.isNotNull(methods, "List of methods cannot be null"); defaultAuthenticationMethods = Lists.newArrayList(Collections2.filter(methods, Predicates.notNull())); }