Package com.smartgwt.client.data

# Class Criteria

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

All Implemented Interfaces:
  `HasHandlers`

Direct Known Subclasses:
  `Criterion`

public class Criteria extends DataClass
Criteria for selecting only a matching set of records from a DataSource. Criteria can be applied on the client and server. Unless configured otherwise, criteria will generally be applied client-side by `ResultSet`s via `ResultSet.applyFilter`.

Client- and server-side systems built into Smart GWT understand two criteria formats by default: simple key-value pairs (Criteria) or the `AdvancedCriteria` format.

Use `DataSource.combineCriteria` to combine two Criteria objects (including Criteria and AdvancedCriteria) or `DataSource.convertCriteria` to convert simple Criteria to the AdvancedCriteria format.

When sent to the Smart GWT server, the Java representation of the criteria is described `here`. When sent to other servers, the `operationBinding.dataProtocol` affects the format.

- ## Field Summary

  ### Fields inherited from class com.smartgwt.client.core.DataClass

  `factoryCreated, factoryProperties`

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

  `jsObj`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Criteria()`
  `Criteria(JavaScriptObject jsObj)`
  `Criteria(String field, String value)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addCriteria(Criteria otherCriteria)`
  Adds the criteria from the passed criteria object.
  `void`
  `addCriteria(String field, Boolean value)`
  `void`
  `addCriteria(String field, Boolean[] value)`
  `void`
  `addCriteria(String field, Double value)`
  `void`
  `addCriteria(String field, Double[] value)`
  `void`
  `addCriteria(String field, Float value)`
  `void`
  `addCriteria(String field, Float[] value)`
  `void`
  `addCriteria(String field, Integer value)`
  `void`
  `addCriteria(String field, Integer[] value)`
  `void`
  `addCriteria(String field, Long value)`
  `void`
  `addCriteria(String field, Long[] value)`
  `void`
  `addCriteria(String field, Object value)`
  `void`
  `addCriteria(String field, String value)`
  `void`
  `addCriteria(String field, String[] value)`
  `void`
  `addCriteria(String field, Date value)`
  `AdvancedCriteria`
  `asAdvancedCriteria()`
  Returns an AdvancedCriteria derived from this Criteria object.
  `static Criteria[]`
  `convertToCriteriaArray(JavaScriptObject nativeArray)`
  `static Criteria`
  `getOrCreateRef(JavaScriptObject jsObj)`
  `Map`
  `getValues()`
  Return the criteria values as a name-value Map.
  `boolean`
  `isAdvanced()`
  Does this represent an underlying AdvancedCriteria object in JavaScript?

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

  `applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, 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, setFactoryCreated`

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

  `equals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObj`

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

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

- ## Constructor Details

  - ### Criteria

    public Criteria()

  - ### Criteria

    public Criteria(String field, String value)

  - ### Criteria

    public Criteria(JavaScriptObject jsObj)

- ## Method Details

  - ### getOrCreateRef

    public static Criteria getOrCreateRef(JavaScriptObject jsObj)

  - ### addCriteria

    public void addCriteria(String field, String value)

  - ### addCriteria

    public void addCriteria(String field, Boolean value)

  - ### addCriteria

    public void addCriteria(String field, Integer value)

  - ### addCriteria

    public void addCriteria(String field, Long value)

  - ### addCriteria

    public void addCriteria(String field, Float value)

  - ### addCriteria

    public void addCriteria(String field, Double value)

  - ### addCriteria

    public void addCriteria(String field, Date value)

  - ### addCriteria

    public void addCriteria(String field, String[] value)

  - ### addCriteria

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

  - ### addCriteria

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

  - ### addCriteria

    public void addCriteria(String field, Long[] value)

  - ### addCriteria

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

  - ### addCriteria

    public void addCriteria(String field, Double[] value)

  - ### addCriteria

    public void addCriteria(String field, Object value)

  - ### addCriteria

    public void addCriteria(Criteria otherCriteria)
    Adds the criteria from the passed criteria object.
    Parameters:
      `otherCriteria` - the passed criteria object

  - ### getValues

    public Map getValues()
    Return the criteria values as a name-value Map.
    Returns:
      the criteria values as a Map

  - ### convertToCriteriaArray

    public static Criteria[] convertToCriteriaArray(JavaScriptObject nativeArray)

  - ### isAdvanced

    public boolean isAdvanced()
    Does this represent an underlying AdvancedCriteria object in JavaScript?
    Returns:

  - ### asAdvancedCriteria

    public AdvancedCriteria asAdvancedCriteria()
    Returns an AdvancedCriteria derived from this Criteria object.
    Returns: