List of usage examples for com.google.common.base Predicates not
public static <T> Predicate<T> not(Predicate<T> predicate)
From source file:com.insightfullogic.stripper.ClassRules.java
@SuppressWarnings("unchecked") public void strip(final ClassNode cls) { final Predicate<MethodNode> onePredicate = Predicates.not(Predicates.or(predicates)); cls.methods = new ArrayList<>(filter(cls.methods, onePredicate)); }
From source file:de.rwth.i9.cimt.configuration.AppConfig.java
@Bean public Docket swaggerSettings() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()) .paths(Predicates.not(PathSelectors.regex("/error.*"))).build().apiInfo(apiInfo()).pathMapping("/"); }
From source file:com.rest.config.SwaggerConfig.java
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).groupName("my java blog apis").apiInfo(apiInfo()).select() .apis(Predicates.or(RequestHandlerSelectors.withClassAnnotation(RestController.class), RequestHandlerSelectors.withMethodAnnotation(ResponseBody.class), RequestHandlerSelectors.withClassAnnotation(ResponseBody.class))) .apis(Predicates.not(RequestHandlerSelectors.withClassAnnotation(SwaggerIgnore.class))) .paths(Predicates.not(PathSelectors.regex("^/error$"))).build().pathMapping("/") .directModelSubstitute(LocalDate.class, String.class).genericModelSubstitutes(ResponseEntity.class) .alternateTypeRules(AlternateTypeRules.newRule( typeResolver.resolve(DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)), typeResolver.resolve(WildcardType.class))) .useDefaultResponseMessages(false) .globalResponseMessage(RequestMethod.GET, Lists.newArrayList(new ResponseMessageBuilder().code(500).message("500 message") .responseModel(new ModelRef("Error")).build())) .securitySchemes(Lists.newArrayList(apiKey())) .securityContexts(Lists.newArrayList(Lists.newArrayList(securityContext()))) .tags(new Tag("my bootstrap blog", "All api relating to blog")); }
From source file:io.github.robwin.swagger2markup.SwaggerConfig.java
@Bean public Docket restApi() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).securitySchemes(asList( new OAuth("petstore_auth", asList(new AuthorizationScope("write_pets", "modify pets in your account"), new AuthorizationScope("read_pets", "read your pets")), Arrays.<GrantType>asList(new ImplicitGrant( new LoginEndpoint("http://petstore.swagger.io/api/oauth/dialog"), "tokenName"))), new ApiKey("api_key", "api_key", "header"))).select() .paths(Predicates.and(ant("/**"), Predicates.not(ant("/error")), Predicates.not(ant("/management/**")), Predicates.not(ant("/management*")))) .build();/*from www.j a v a2 s. co m*/ }
From source file:io.brooklyn.ambari.AmbariLiveTestHelper.java
protected void assertHadoopClusterEventuallyDeployed(Application app) { AmbariServer ambariServer = Entities.descendants(app, AmbariServer.class).iterator().next(); EntityTestUtils.assertAttributeEventually(ImmutableMap.of("timeout", Duration.minutes(60)), ambariServer, AmbariServer.CLUSTER_STATE, Predicates.not(Predicates.or(Predicates.equalTo("ABORTED"), Predicates.equalTo("FAILED"), Predicates.equalTo("TIMEDOUT")))); EntityTestUtils.assertAttributeEventually(ImmutableMap.of("timeout", Duration.minutes(60)), ambariServer, AmbariServer.CLUSTER_STATE, Predicates.equalTo("COMPLETED")); }
From source file:gg.uhc.uhc.modules.team.NoTeamCommand.java
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Iterable<? extends Player> noTeam = Iterables.filter(Bukkit.getOnlinePlayers(), Predicates.not(HAS_TEAM)); String noTeamNames = Joiner.on(", ").join(Iterables.transform(noTeam, FunctionalUtil.PLAYER_NAME_FETCHER)); if (noTeamNames.length() == 0) noTeamNames = messages.getRaw("none"); sender.sendMessage(messages.evalTemplate("list", ImmutableMap.of("players", noTeamNames))); return true;//from w w w. j a va2 s . c o m }
From source file:org.sosy_lab.cpachecker.util.expressions.And.java
public static <LeafType> ExpressionTree<LeafType> of(Iterable<ExpressionTree<LeafType>> pOperands) { // If one of the operands is false, return false if (Iterables.contains(pOperands, ExpressionTrees.getFalse())) { return ExpressionTrees.getFalse(); }// w w w. j a v a 2 s . c om // Filter out trivial operands and flatten the hierarchy ImmutableSet<ExpressionTree<LeafType>> operands = FluentIterable.from(pOperands) .filter(Predicates.not(Predicates.equalTo(ExpressionTrees.<LeafType>getTrue()))) .transformAndConcat(new Function<ExpressionTree<LeafType>, Iterable<ExpressionTree<LeafType>>>() { @Override public Iterable<ExpressionTree<LeafType>> apply(ExpressionTree<LeafType> pOperand) { if (pOperand instanceof And) { return (And<LeafType>) pOperand; } return Collections.singleton(pOperand); } }).toSet(); // If there are no operands, return the neutral element if (operands.isEmpty()) { return ExpressionTrees.getTrue(); } // If there is only one operand, return it if (operands.size() == 1) { return operands.iterator().next(); } return new And<>(operands); }
From source file:playground.michalm.util.gis.PolygonBasedFilter.java
public static Iterable<? extends Link> filterLinksOutsidePolygon(Iterable<? extends Link> links, Geometry polygonGeometry, boolean includeBorderLinks) { return Iterables.filter(links, Predicates.not(createLinkInsidePolygonPredicate(polygonGeometry, !includeBorderLinks)));// includeBorderLinks must be negated }
From source file:net.derquinse.common.meta.MetaFlag.java
/** * Returns a predicate that evaluates to {@code true} if this flag evaluates to {@code false}. *//*from w ww . j a v a 2 s . c o m*/ public final Predicate<C> not() { return Predicates.not(this); }
From source file:org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.validator.DestroyMessageCreationValidator.java
/** * Check that there is not {@link ISequenceEvent} on the target lifeline * with range's upperbound upper than the firstClickLocation.y . * /*www. j a va 2s . c om*/ * @return true if not {@link ISequenceEvent} upper than * firstClickLocation.y */ private boolean checkNotEventAtUpperTimeInSameLifeline() { boolean valid = true; SequenceDiagram sequenceDiagram = sequenceElementSource.getDiagram(); SequenceDiagramQuery sequenceDiagramQuery = new SequenceDiagramQuery(sequenceDiagram); for (ISequenceEvent sequenceEvent : Iterables.filter( sequenceDiagramQuery.getAllSequenceEventsUpperThan(firstClickLocation.y), Predicates.not(Predicates.instanceOf(Lifeline.class)))) { if (isSequenceEventOfLifeline(sequenceEvent, sequenceElementTarget.getLifeline()) || isMessageTargeting(sequenceEvent, sequenceElementTarget.getLifeline()) || isDestroyMessageFor(sequenceEvent, sequenceElementTarget.getLifeline().get().getInstanceRole())) { valid = false; break; } } return valid; }