com.smartgwt.client.data

## Class Criterion

- java.lang.Object
- - com.smartgwt.client.core.JsObject
  - - com.smartgwt.client.core.DataClass
    - - com.smartgwt.client.data.Criteria
      - - com.smartgwt.client.data.Criterion

- Direct Known Subclasses:
    AdvancedCriteria

      public class Criterion
      extends Criteria

  An object representing a criterion to apply to a record.

  A criterion is part of the definition of an `AdvancedCriteria` object, which is used to filter records according to search criteria.

  A criterion consists of an `operator` and typically a `fieldName` from a `Record` and a `value` to compare to. However some operators either don't require a value (eg, isNull) or act on other criteria rather than directly on a `Record`'s fields (eg, the "and" and "or" logical operators).

- - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.core.JsObject

      `jsObj`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Criterion()`
    `Criterion(Criterion c)`
    `Criterion(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `Criterion(OperatorId operator)`
    `Criterion(OperatorId operator, Criterion[] criterias)`
    `Criterion(java.lang.String fieldName, OperatorId operator)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Boolean value)` Constructor for Criterion with fieldName, operator and value.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Boolean[] value)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.util.Date value)` Constructor for Criterion with fieldName, operator and value.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.util.Date[] value)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.util.Date start, java.util.Date end)` Constructor for Criterion with fieldName, operator, start and end values.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Float value)` Constructor for Criterion with fieldName, operator and value.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Float[] value)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Float start, java.lang.Float end)` Constructor for Criterion with fieldName, operator, start and end values.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Integer value)` Constructor for Criterion with fieldName, operator and value.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Integer[] value)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Integer start, java.lang.Integer end)` Constructor for Criterion with fieldName, operator, start and end values.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Long value)` Constructor for Criterion with fieldName, operator and value.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Long[] value)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.Long start, java.lang.Long end)` Constructor for Criterion with fieldName, operator, start and end values.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.String value)` Constructor for Criterion with fieldName, operator and value.
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.String[] value)`
    `Criterion(java.lang.String fieldName, OperatorId operator, java.lang.String start, java.lang.String end)` Constructor for Criterion with fieldName, operator, start and end values.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCriteria(Criterion c)` Adds a new criteria.
    `void` | `addCriteria(java.lang.String field, java.lang.Boolean value)`
    `void` | `addCriteria(java.lang.String field, java.lang.Boolean[] value)`
    `void` | `addCriteria(java.lang.String field, java.util.Date value)`
    `void` | `addCriteria(java.lang.String field, java.util.Date[] value)`
    `void` | `addCriteria(java.lang.String field, java.lang.Float value)`
    `void` | `addCriteria(java.lang.String field, java.lang.Float[] value)`
    `void` | `addCriteria(java.lang.String field, java.lang.Integer value)`
    `void` | `addCriteria(java.lang.String field, java.lang.Integer[] value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.Boolean value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.Boolean[] value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.util.Date value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.util.Date[] value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.Float value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.Float[] value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.Integer value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.Integer[] value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.String value)`
    `void` | `addCriteria(java.lang.String field, OperatorId op, java.lang.String[] value)`
    `void` | `addCriteria(java.lang.String field, java.lang.String value)`
    `void` | `addCriteria(java.lang.String field, java.lang.String[] value)`
    `void` | `appendToCriterionList(Criterion c)`
    `void` | `buildCriterionFromList(OperatorId operator, Criterion[] criterias)`
    `Criterion[]` | `getCriteria()` Returns an array of sub-criteria for this criterion.
    `java.lang.String` | `getFieldName()` Name of the field in each `Record` that this criterion applies to.
    `OperatorId` | `getOperator()` Operator this criterion applies.
    `static Criterion` | `getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `java.lang.Boolean` | `getValueAsBoolean()` Retrieves the specified value for this criterion.
    `java.util.Date` | `getValueAsDate()` Retrieves the specified value for this criterion.
    `java.lang.Float` | `getValueAsFloat()` Retrieves the specified value for this criterion.
    `java.lang.Integer` | `getValueAsInt()` Synonym of `getValueAsInteger()`.
    `int[]` | `getValueAsIntArray()` Retrieves the specified value for this criterion.
    `java.lang.Integer` | `getValueAsInteger()` Retrieves the specified value for this criterion.
    `java.lang.String` | `getValueAsString()` Retrieves the specified value for this criterion.
    `java.lang.String[]` | `getValueAsStringArray()` Retrieves the specified value for this criterion.
    `void` | `markAdvancedCriteria()`
    `void` | `setFieldName(java.lang.String fieldName)` Name of the field in each `Record` that this criterion applies to.
    `void` | `setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `void` | `setOperator(OperatorId operator)` Operator this criterion applies.
    `void` | `unmarkAdvancedCriteria()`

    - ### Methods inherited from class com.smartgwt.client.data.Criteria

      `addCriteria, addCriteria, addCriteria, addCriteria, asAdvancedCriteria, convertToCriteriaArray, getValues, isAdvanced`

    - ### Methods inherited from class com.smartgwt.client.core.DataClass

      `doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject`

    - ### Methods inherited from class com.smartgwt.client.core.JsObject

      `equals, hashCode, isCreated, setJsObj`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Criterion

          public Criterion()

    - #### Criterion

          public Criterion(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### Criterion

          public Criterion(Criterion c)

    - #### Criterion

          public Criterion(OperatorId operator,
                   Criterion[] criterias)

    - #### Criterion

          public Criterion(OperatorId operator)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Integer value)

      Constructor for Criterion with fieldName, operator and value.
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `value` - the value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Integer start,
                   java.lang.Integer end)

      Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator is `OperatorId.BETWEEN` or `OperatorId.BETWEEN_INCLUSIVE`
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `start` - the start value
        `end` - the end value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.String value)

      Constructor for Criterion with fieldName, operator and value.
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `value` - the value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.String start,
                   java.lang.String end)

      Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator is `OperatorId.BETWEEN` or `OperatorId.BETWEEN_INCLUSIVE`
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `start` - the start value
        `end` - the end value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Float value)

      Constructor for Criterion with fieldName, operator and value.
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `value` - the value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Float start,
                   java.lang.Float end)

      Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator is `OperatorId.BETWEEN` or `OperatorId.BETWEEN_INCLUSIVE`
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `start` - the start value
        `end` - the end value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.util.Date value)

      Constructor for Criterion with fieldName, operator and value.
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `value` - the value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.util.Date start,
                   java.util.Date end)

      Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator is `OperatorId.BETWEEN` or `OperatorId.BETWEEN_INCLUSIVE`
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `start` - the start value
        `end` - the end value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Boolean value)

      Constructor for Criterion with fieldName, operator and value.
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `value` - the value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Long value)

      Constructor for Criterion with fieldName, operator and value. Note that JavaScript does not natively have an equivalent format to Java long (fixed point 64 bit). As such the value passed in will be converted to a double value for storage.
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `value` - the value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Long start,
                   java.lang.Long end)

      Constructor for Criterion with fieldName, operator, start and end values. This constructor is only valid when the operator is `OperatorId.BETWEEN` or `OperatorId.BETWEEN_INCLUSIVE`
      Parameters:
        `fieldName` - the field name
        `operator` - the operator
        `start` - the start value
        `end` - the end value

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Integer[] value)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.String[] value)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Float[] value)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Long[] value)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.util.Date[] value)

    - #### Criterion

          public Criterion(java.lang.String fieldName,
                   OperatorId operator,
                   java.lang.Boolean[] value)

  - ### Method Detail

    - #### getOrCreateRef

          public static Criterion getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### setJavaScriptObject

          public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### setFieldName

          public void setFieldName(java.lang.String fieldName)

      Name of the field in each `Record` that this criterion applies to. Not applicable for a criterion with `sub-criteria`. Can be specified as a dataPath to allow matching nested objects. Use '/' as delimiters for dataPath. See dataPath for more information.
      Parameters:
        `fieldName` - . See `String`. Default value is null

    - #### getFieldName

          public java.lang.String getFieldName()

      Name of the field in each `Record` that this criterion applies to. Not applicable for a criterion with `sub-criteria`. Can be specified as a dataPath to allow matching nested objects. Use '/' as delimiters for dataPath. See dataPath for more information.
      Returns:
        . See `String`

    - #### setOperator

          public void setOperator(OperatorId operator)

      Operator this criterion applies.
      Parameters:
        `operator` - operator Default value is null

    - #### getOperator

          public OperatorId getOperator()

      Operator this criterion applies.
      Returns:
        OperatorId

    - #### addCriteria

          public void addCriteria(Criterion c)

      Adds a new criteria.

      If the present criteria operation is "and", the new criteria is appended to the criteria list.

      Otherwise, the existing criteria is replaced with an "and" criteria, with two sub-criteria: the existing criteria, and the passed criteria.

      Note that if the existing criteria was empty (as would happen if new AdvancedCriteria() were called with no arguments), an "and" operator will still be introduced, but the passed criteria will be the only sub-criteria.

      Parameters:
        `c` - the passed criteria object

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.String value)

      Overrides:
        `addCriteria` in class `Criteria`
      See Also:
        `addCriteria(Criterion)`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.Integer value)

      Overrides:
        `addCriteria` in class `Criteria`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.Float value)

      Overrides:
        `addCriteria` in class `Criteria`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.util.Date value)

      Overrides:
        `addCriteria` in class `Criteria`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.Boolean value)

      Overrides:
        `addCriteria` in class `Criteria`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.String[] value)

      Overrides:
        `addCriteria` in class `Criteria`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.Integer[] value)

      Overrides:
        `addCriteria` in class `Criteria`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.Float[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.util.Date[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         java.lang.Boolean[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.String value)

      See Also:
        `addCriteria(Criterion)`

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.Integer value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.Float value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.util.Date value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.Boolean value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.String[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.Integer[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.Float[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.util.Date[] value)

    - #### addCriteria

          public void addCriteria(java.lang.String field,
                         OperatorId op,
                         java.lang.Boolean[] value)

    - #### buildCriterionFromList

          public void buildCriterionFromList(OperatorId operator,
                                    Criterion[] criterias)

    - #### appendToCriterionList

          public void appendToCriterionList(Criterion c)

    - #### markAdvancedCriteria

          public void markAdvancedCriteria()

    - #### unmarkAdvancedCriteria

          public void unmarkAdvancedCriteria()

    - #### getCriteria

          public Criterion[] getCriteria()

      Returns an array of sub-criteria for this criterion. Will return null if there are no sub criterion. Only applicable for criterion with operator type set to `AND` or `OR`.
      Returns:
        String

    - #### getValueAsString

          public java.lang.String getValueAsString()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns:

    - #### getValueAsInt

          public final java.lang.Integer getValueAsInt()

      Synonym of `getValueAsInteger()`.

    - #### getValueAsInteger

          public java.lang.Integer getValueAsInteger()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns:

    - #### getValueAsFloat

          public java.lang.Float getValueAsFloat()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns:

    - #### getValueAsDate

          public java.util.Date getValueAsDate()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns:

    - #### getValueAsBoolean

          public java.lang.Boolean getValueAsBoolean()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns:

    - #### getValueAsStringArray

          public java.lang.String[] getValueAsStringArray()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns:

    - #### getValueAsIntArray

          public int[] getValueAsIntArray()

      Retrieves the specified value for this criterion. Only applies to criterion where operator and value have been specified - will not apply to criterion containing `#getCriteria(),sub criteria`.
      Returns: