Example usage for com.google.common.base Predicates or

List of usage examples for com.google.common.base Predicates or

Introduction

In this page you can find the example usage for com.google.common.base Predicates or.

Prototype

public static <T> Predicate<T> or(Predicate<? super T>... components) 

Source Link

Document

Returns a predicate that evaluates to true if any one of its components evaluates to true .

Usage

From source file:org.richfaces.cdk.util.MorePredicates.java

public static <S, D> Predicate<D> any(Iterable<S> options, Function<S, Predicate<D>> function) {
    if (options == null || Iterables.isEmpty(options)) {
        return Predicates.alwaysTrue();
    }//  www .  java 2s  . c  o m

    return Predicates.or(Iterables.transform(options, function));
}

From source file:com.marvelution.hudson.plugins.apiv2.cache.activity.ActivityCachePredicates.java

public static Predicate<ActivityCache> relatesToJobs(final String[] jobnames) {
    List<Predicate<ActivityCache>> predicates = Lists.newArrayList();
    for (final String jobname : jobnames) {
        if (StringUtils.isNotBlank(jobname)) {
            predicates.add(relatesToJob(jobname));
        }//from w  w w  .  j  av a 2s .  co  m
    }
    return Predicates.or(predicates);
}

From source file:org.richfaces.cdk.util.MorePredicates.java

public static <S, D> Predicate<D> none(Iterable<S> options, Function<S, Predicate<D>> function) {
    if (options == null || Iterables.isEmpty(options)) {
        return Predicates.alwaysTrue();
    }//w  w w . j  av  a  2s .c o  m

    Predicate<D> compositePredicate = Predicates.or(Iterables.transform(options, function));
    return Predicates.not(compositePredicate);
}

From source file:org.jon.ivmark.graphit.core.properties.filter.OrFilter.java

public OrFilter(List<Map<String, Object>> conditions) {
    super(conditions);
    this.filter = Predicates.or(filters);
}

From source file:com.donler.gym.docs.SwaggerConfig.java

private Predicate<String> userPath() {
    return Predicates.or(PathSelectors.regex("^/(?!error).*$")
    //        PathSelectors.regex("/business*"),
    //        PathSelectors.regex("/bargain*")
    );//from w ww. j a va 2s. co m
}

From source file:com.lithium.flow.filer.chain.SubpathsFilerChain.java

public SubpathsFilerChain(@Nonnull Config config) {
    checkNotNull(config);/*from   ww w  .  ja  v a2s.com*/
    predicate = Predicates
            .or(config.getList("subpaths").stream().map(RegexSubpathPredicate::new).collect(toList()));
}

From source file:de.metas.ui.web.config.SwaggerConfig.java

@SuppressWarnings("unused")
private static final Predicate<RequestHandler> basePackages(final Class<?>... classes) {
    final Set<Predicate<RequestHandler>> predicates = new HashSet<>(classes.length);
    for (final Class<?> clazz : classes) {
        final String packageName = clazz.getPackage().getName();
        predicates.add(RequestHandlerSelectors.basePackage(packageName));
    }//from ww  w . ja va 2 s  . c o  m

    if (predicates.size() == 1) {
        return predicates.iterator().next();
    }

    return Predicates.or(predicates);
}

From source file:com.newsweaver.LotterySystemApplication.java

private Predicate<String> paths() {
    // any api that matches one of these paths
    return Predicates.or(PathSelectors.regex("/v1/.*"));
}

From source file:com.marvelution.hudson.plugins.apiv2.cache.activity.ActivityCachePredicates.java

public static Predicate<ActivityCache> relatesToUsers(final String[] usernames) {
    List<Predicate<ActivityCache>> predicates = Lists.newArrayList();
    for (final String username : usernames) {
        if (StringUtils.isNotBlank(username)) {
            predicates.add(relatesToUser(username));
        }/*w  w w  .  ja  v a2  s.com*/
    }
    return Predicates.or(predicates);
}

From source file:eu.numberfour.n4js.n4mf.utils.ProjectTypePredicate.java

/**
 * Sugar for creating a new predicate that is the logical disjunction of the given predicates.
 *
 * @param first//from   w w  w . j a  v  a  2s .c  o m
 *            the first predicate.
 * @param second
 *            the second predicate.
 * @param others
 *            the rest of the predicates. Optional, can be omitted, but when given must not contain {@code null}.
 * @return a logical disjunction of the predicates.
 */
public static ProjectTypePredicate or(ProjectTypePredicate first, ProjectTypePredicate second,
        ProjectTypePredicate... others) {

    return new ProjectTypePredicate(Predicates.or(Lists.asList(first, second, others)));
}