List of usage examples for com.google.common.base Predicates or
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second)
From source file:com.zoo.configuration.SwaggerConfig.java
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()) .paths(Predicates.or(PathSelectors.ant("/rest/animals/**"), PathSelectors.ant("/rest/staff/**"))) .build().pathMapping("/").apiInfo(apiInfo()); }
From source file:org.apache.brooklyn.util.core.ResourcePredicates.java
/** * @return A predicate that tests whether its input is either empty or a resource readable by Brooklyn. * @see StringPredicates#isBlank// w w w.j av a 2 s . co m * @see #urlExists */ public static Predicate<String> urlIsBlankOrExists() { return Predicates.or(StringPredicates.isBlank(), urlExists()); }
From source file:org.peletomi.vax.impl.IterableMethods.java
@Override public Iterator<Method> iterator() { return Iterators.filter(new MethodIterator(instance), and(BeanUtils.IS_VALUE, Predicates.or(BeanUtils.IS_GETTER, BeanUtils.IS_SETTER))); }
From source file:org.n52.sos.ogc.sensorML.elements.SmlIdentifierPredicates.java
public static Predicate<SmlIdentifier> nameOrDefinition(String name, String definition) { return Predicates.or(name(name), definition(definition)); }
From source file:org.mustbe.consulo.roots.ContentFolderScopes.java
@NotNull public static Predicate<ContentFolderTypeProvider> production() { return cacheScope(PRODUCTION, new NotNullFactory<Predicate<ContentFolderTypeProvider>>() { @NotNull/* w w w . j a v a 2 s . com*/ @Override public Predicate<ContentFolderTypeProvider> create() { return Predicates.or( Predicates.<ContentFolderTypeProvider>equalTo( ProductionContentFolderTypeProvider.getInstance()), Predicates.<ContentFolderTypeProvider>equalTo( ProductionResourceContentFolderTypeProvider.getInstance())); } }); }
From source file:service.SwaggerConfig.java
@Bean public Docket secureApi() { return new Docket(DocumentationType.SWAGGER_2) //.groupName("Ldap") .apiInfo(secureapiInfo()).select().apis(RequestHandlerSelectors.any()) .paths(Predicates.or(PathSelectors.regex("/ldap/.*"), PathSelectors.regex("/security/.*"))).build(); }
From source file:com.wumugulu.config.Swagger2Define.java
private Predicate<String> getPaths() { return Predicates.or(PathSelectors.regex("/users.*"), PathSelectors.regex("/books.*")); }
From source file:edu.buaa.satla.analysis.util.GraphUtils.java
/** * Project a graph to a subset of "relevant" nodes. * The result is a SetMultimap containing the successor relationships between all relevant nodes. * A pair of nodes (a, b) is in the SetMultimap, * if there is a path through the graph from a to b which does not pass through * any other relevant node.//from ww w. j a v a 2 s .com * * To get the predecessor relationship, you can use {@link Multimaps#invertFrom(com.google.common.collect.Multimap, com.google.common.collect.Multimap)}. * * @param root The start of the graph to project (always considered relevant). * @param isRelevant The predicate determining which nodes are in the resulting relationship. * @param successorFunction A function giving the direct successors of any node. * @param <N> The node type of the graph. */ public static <N> SetMultimap<N, N> projectARG(final N root, final Function<? super N, ? extends Iterable<N>> successorFunction, Predicate<? super N> isRelevant) { isRelevant = Predicates.or(Predicates.equalTo(root), isRelevant); SetMultimap<N, N> successors = HashMultimap.create(); // Our state is a stack of pairs of todo items. // The first item of each pair is a relevant state, // for which we are looking for relevant successor states. // The second item is a state, // whose children should be handled next. Deque<Pair<N, N>> todo = new ArrayDeque<>(); Set<N> visited = new HashSet<>(); todo.push(Pair.of(root, root)); while (!todo.isEmpty()) { final Pair<N, N> currentPair = todo.pop(); final N currentPredecessor = currentPair.getFirst(); final N currentState = currentPair.getSecond(); if (!visited.add(currentState)) { continue; } for (N child : successorFunction.apply(currentState)) { if (isRelevant.apply(child)) { successors.put(currentPredecessor, child); todo.push(Pair.of(child, child)); } else { todo.push(Pair.of(currentPredecessor, child)); } } } return successors; }
From source file:df.open.support.configuration.SwaggerConfiguration.java
@Bean public Docket swaggerApi() { System.out.println("?Swagger-api"); //selector /*from w w w . ja v a2s .co m*/ Predicate<RequestHandler> selector = Predicates.or((withClassAnnotation(Api.class)), (withMethodAnnotation(Api.class))); //RequestHandlerSelectors.any() //RequestHandlerSelectors.basePackage("com.example.controller") //path RequestMapping Predicate<String> apiPath = StringUtils.isEmpty(path) ? PathSelectors.any() : PathSelectors.ant(path); return new Docket(DocumentationType.SWAGGER_2).groupName("Base").select() // api?document .apis(selector) // api .paths(apiPath) // .build().apiInfo(apiInfo()); }
From source file:com.webbfontaine.valuewebb.irms.impl.bean.Calculator.java
private static boolean anyNullOrZero(BigDecimal... values) { Predicate<BigDecimal> composite = Predicates.or(new EqualsNullPredicate(), new EqualsZeroPredicate()); return Iterators.any(Iterators.forArray(values), composite); }