org.springframework.data.mongodb.core.query.Criteria.not()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(364)

本文整理了Java中org.springframework.data.mongodb.core.query.Criteria.not()方法的一些代码示例,展示了Criteria.not()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Criteria.not()方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Criteria
类名称:Criteria
方法名:not

Criteria.not介绍

[英]Creates a criterion using the $not meta operator which affects the clause directly following
[中]使用$not元运算符创建一个条件,该运算符直接影响后面的子句

代码示例

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Creates a criterion using the {@literal $not} meta operator which affects the clause directly following
 *
 * @return
 * @see <a href="https://docs.mongodb.com/manual/reference/operator/query/not/">MongoDB Query operator: $not</a>
 */
public Criteria not() {
  return not(null);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

public Criteria regex(BsonRegularExpression regex) {
  if (lastOperatorWasNot()) {
    return not(regex);
  }
  this.isValue = regex;
  return this;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Syntactical sugar for {@link #is(Object)} making obvious that we create a regex predicate.
 *
 * @param pattern
 * @return
 */
public Criteria regex(Pattern pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  if (lastOperatorWasNot()) {
    return not(pattern);
  }
  this.isValue = pattern;
  return this;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

criteria = criteria.not();

代码示例来源:origin: org.springframework.data/spring-data-mongodb

/**
 * Creates a criterion using the {@literal $not} meta operator which affects the clause directly following
 *
 * @return
 * @see <a href="https://docs.mongodb.com/manual/reference/operator/query/not/">MongoDB Query operator: $not</a>
 */
public Criteria not() {
  return not(null);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

return createContainingCriteria(part, property, criteria, parameters);
case NOT_LIKE:
  return createContainingCriteria(part, property, criteria.not(), parameters);
case NOT_CONTAINING:
  return createContainingCriteria(part, property, criteria.not(), parameters);
case REGEX:

代码示例来源:origin: org.springframework.data/spring-data-mongodb

public Criteria regex(BsonRegularExpression regex) {
  if (lastOperatorWasNot()) {
    return not(regex);
  }
  this.isValue = regex;
  return this;
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

/**
 * Syntactical sugar for {@link #is(Object)} making obvious that we create a regex predicate.
 *
 * @param pattern
 * @return
 */
public Criteria regex(Pattern pattern) {
  Assert.notNull(pattern, "Pattern must not be null!");
  if (lastOperatorWasNot()) {
    return not(pattern);
  }
  this.isValue = pattern;
  return this;
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

criteria = criteria.not();

代码示例来源:origin: org.springframework.data/spring-data-mongodb

return createContainingCriteria(part, property, criteria, parameters);
case NOT_LIKE:
  return createContainingCriteria(part, property, criteria.not(), parameters);
case NOT_CONTAINING:
  return createContainingCriteria(part, property, criteria.not(), parameters);
case REGEX:

代码示例来源:origin: org.jspresso.framework/jspresso-mongo

criteria = criteria.not();

代码示例来源:origin: pl.edu.icm.polindex/polindex-core

private Criteria proposalsExistsCriterion(Boolean notificationsExists) {
  if(notificationsExists) {
    return Criteria.where(PROPERTY_PROPOSALS).not().size(0);
  }
  return Criteria.where(PROPERTY_PROPOSALS).size(0);
}

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public List<GridFSDBFile> findModifiedLaterAgo(Duration period, String project) {
  return gridFs.find(ModifiableQueryBuilder.findModifiedLaterThanPeriod(period, project)
      .addCriteria(where("filename").not().regex(PHOTO_PREFIX)));
}

代码示例来源:origin: dk.apaq.framework/criteria-mongo

NotRule af = (NotRule) filter;
clause.not();
return buildCriteria(clause, af.getRuleElement());

代码示例来源:origin: com.epam.reportportal/commons-dao

public static Function<FilterCondition, Criteria> filterConverter(CriteriaMap<?> map) {
    return filterCondition -> {
      Optional<CriteriaHolder> criteriaHolder = map.getCriteriaHolderUnchecked(filterCondition.getSearchCriteria());
      BusinessRule.expect(criteriaHolder, Preconditions.IS_PRESENT).verify(ErrorType.INCORRECT_FILTER_PARAMETERS,
          Suppliers.formattedSupplier("Filter parameter {} is not defined", filterCondition.getSearchCriteria()));

      Criteria searchCriteria;
      if (criteriaHolder.get().isReference()) {
        searchCriteria = Criteria.where(criteriaHolder.get().getQueryCriteria().concat(REFERENCE_POSTFIX));
      } else {
        searchCriteria = Criteria.where(criteriaHolder.get().getQueryCriteria());
      }

      /* Does FilterCondition contains negative=true? */
      if (filterCondition.isNegative()) {
        searchCriteria = searchCriteria.not();
      }

      filterCondition.getCondition().addCondition(searchCriteria, filterCondition, criteriaHolder.get());

      return searchCriteria;
    };
  }
}

相关文章