Spring-data-mongodb Criteria類介紹

類 Criteria

  • java.lang.Object
    • org.springframework.data.mongodb.core.query.Criteria
  • 所有已實現的接口:
    CriteriaDefinition
    直接已知子類:
    GridFsCriteria


    public class Criteria
    extends java.lang.Object
    implements CriteriaDefinition
    Central class for creating queries. It follows a fluent API style so that you can easily chain together multiple criteria. Static import of the 'Criteria.where' method will improve readability.
    • 構造器概要

      構造器 
      限定符 構造器和說明
        Criteria() 
      protected Criteria(java.util.List<Criteria> criteriaChain, java.lang.String key) 
        Criteria(java.lang.String key) 
    • 方法概要

      方法 
      限定符和類型 方法和說明
      Criteria all(java.util.Collection<?> o) 
      Criteria all(java.lang.Object... o)
      Creates a criterion using the $all operator
      Criteria and(java.lang.String key)
      Static factory method to create a Criteria using the provided key
      Criteria andOperator(Criteria... criteria)
      Creates an 'and' criteria using the $and operator for all of the provided criteria
      Criteria elemMatch(Criteria c)
      Creates a criterion using the $elemMatch operator
      boolean equals(java.lang.Object obj) 
      Criteria exists(boolean b)
      Creates a criterion using the $exists operator
      DBObject getCriteriaObject() 
      java.lang.String getKey() 
      protected DBObject getSingleCriteriaObject() 
      Criteria gt(java.lang.Object o)
      Creates a criterion using the $gt operator
      Criteria gte(java.lang.Object o)
      Creates a criterion using the $gte operator
      int hashCode() 
      Criteria in(java.util.Collection<?> c)
      Creates a criterion using the $in operator
      Criteria in(java.lang.Object... o)
      Creates a criterion using the $in operator
      Criteria is(java.lang.Object o)
      Creates a criterion using equality
      Criteria lt(java.lang.Object o)
      Creates a criterion using the $lt operator
      Criteria lte(java.lang.Object o)
      Creates a criterion using the $lte operator
      Criteria maxDistance(double maxDistance)
      Creates a geospatical criterion using a $maxDistance operation, for use with $near
      Criteria mod(java.lang.Number value, java.lang.Number remainder)
      Creates a criterion using the $mod operator
      Criteria ne(java.lang.Object o)
      Creates a criterion using the $ne operator
      Criteria near(Point point)
      Creates a geospatial criterion using a $near operation
      Criteria nearSphere(Point point)
      Creates a geospatial criterion using a $nearSphere operation.
      Criteria nin(java.util.Collection<?> o) 
      Criteria nin(java.lang.Object... o)
      Creates a criterion using the $nin operator
      Criteria norOperator(Criteria... criteria)
      Creates a 'nor' criteria using the $nor operator for all of the provided criteria
      Criteria not()
      Creates a criterion using the $not meta operator which affects the clause directly following
      Criteria orOperator(Criteria... criteria)
      Creates an 'or' criteria using the $or operator for all of the provided criteria
      Criteria regex(java.util.regex.Pattern pattern)
      Syntactical sugar for is(Object) making obvious that we create a regex predicate.
      Criteria regex(java.lang.String re)
      Creates a criterion using a $regex
      Criteria regex(java.lang.String re, java.lang.String options)
      Creates a criterion using a $regex and $options
      Criteria size(int s)
      Creates a criterion using the $size operator
      Criteria type(int t)
      Creates a criterion using the $type operator
      static Criteria where(java.lang.String key)
      Static factory method to create a Criteria using the provided key
      Criteria within(Shape shape) 
      Criteria withinSphere(Circle circle)
      Creates a geospatial criterion using a $within $center operation.
      • 從類繼承的方法 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • 構造器詳細資料

      • Criteria

        public Criteria()
      • Criteria

        public Criteria(java.lang.String key)
      • Criteria

        protected Criteria(java.util.List<Criteria> criteriaChain,
                java.lang.String key)
    • 方法詳細資料

      • where

        public static Criteria where(java.lang.String key)
        Static factory method to create a Criteria using the provided key
        參數:
        key -
        返回:
      • and

        public Criteria and(java.lang.String key)
        Static factory method to create a Criteria using the provided key
        返回:
      • is

        public Criteria is(java.lang.Object o)
        Creates a criterion using equality
        參數:
        o -
        返回:
      • ne

        public Criteria ne(java.lang.Object o)
        Creates a criterion using the $ne operator
        參數:
        o -
        返回:
      • lt

        public Criteria lt(java.lang.Object o)
        Creates a criterion using the $lt operator
        參數:
        o -
        返回:
      • lte

        public Criteria lte(java.lang.Object o)
        Creates a criterion using the $lte operator
        參數:
        o -
        返回:
      • gt

        public Criteria gt(java.lang.Object o)
        Creates a criterion using the $gt operator
        參數:
        o -
        返回:
      • gte

        public Criteria gte(java.lang.Object o)
        Creates a criterion using the $gte operator
        參數:
        o -
        返回:
      • in

        public Criteria in(java.lang.Object... o)
        Creates a criterion using the $in operator
        參數:
        o - the values to match against
        返回:
      • in

        public Criteria in(java.util.Collection<?> c)
        Creates a criterion using the $in operator
        參數:
        c - the collection containing the values to match against
        返回:
      • nin

        public Criteria nin(java.lang.Object... o)
        Creates a criterion using the $nin operator
        參數:
        o -
        返回:
      • nin

        public Criteria nin(java.util.Collection<?> o)
      • mod

        public Criteria mod(java.lang.Number value,
                   java.lang.Number remainder)
        Creates a criterion using the $mod operator
        參數:
        value -
        remainder -
        返回:
      • all

        public Criteria all(java.lang.Object... o)
        Creates a criterion using the $all operator
        參數:
        o -
        返回:
      • all

        public Criteria all(java.util.Collection<?> o)
      • size

        public Criteria size(int s)
        Creates a criterion using the $size operator
        參數:
        s -
        返回:
      • exists

        public Criteria exists(boolean b)
        Creates a criterion using the $exists operator
        參數:
        b -
        返回:
      • type

        public Criteria type(int t)
        Creates a criterion using the $type operator
        參數:
        t -
        返回:
      • not

        public Criteria not()
        Creates a criterion using the $not meta operator which affects the clause directly following
        返回:
      • regex

        public Criteria regex(java.lang.String re)
        Creates a criterion using a $regex
        參數:
        re -
        返回:
      • regex

        public Criteria regex(java.lang.String re,
                     java.lang.String options)
        Creates a criterion using a $regex and $options
        參數:
        re -
        options -
        返回:
      • regex

        public Criteria regex(java.util.regex.Pattern pattern)
        Syntactical sugar for is(Object) making obvious that we create a regex predicate.
        參數:
        pattern -
        返回:
      • withinSphere

        public Criteria withinSphere(Circle circle)
        Creates a geospatial criterion using a $within $center operation. This is only available for Mongo 1.7 and higher.
        參數:
        circle - must not be null
        返回:
      • near

        public Criteria near(Point point)
        Creates a geospatial criterion using a $near operation
        參數:
        point - must not be null
        返回:
      • nearSphere

        public Criteria nearSphere(Point point)
        Creates a geospatial criterion using a $nearSphere operation. This is only available for Mongo 1.7 and higher.
        參數:
        point - must not be null
        返回:
      • maxDistance

        public Criteria maxDistance(double maxDistance)
        Creates a geospatical criterion using a $maxDistance operation, for use with $near
        參數:
        maxDistance -
        返回:
      • elemMatch

        public Criteria elemMatch(Criteria c)
        Creates a criterion using the $elemMatch operator
        參數:
        c -
        返回:
      • orOperator

        public Criteria orOperator(Criteria... criteria)
        Creates an 'or' criteria using the $or operator for all of the provided criteria
        參數:
        criteria -
      • norOperator

        public Criteria norOperator(Criteria... criteria)
        Creates a 'nor' criteria using the $nor operator for all of the provided criteria
        參數:
        criteria -
      • andOperator

        public Criteria andOperator(Criteria... criteria)
        Creates an 'and' criteria using the $and operator for all of the provided criteria
        參數:
        criteria -
      • getKey

        public java.lang.String getKey()
      • getSingleCriteriaObject

        protected DBObject getSingleCriteriaObject()
      • equals

        public boolean equals(java.lang.Object obj)
        覆蓋:
        equals 在類中 java.lang.Object
      • hashCode

        public int hashCode()
        覆蓋:
        hashCode 在類中 java.lang.Object
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章