org.apache.beehive.netui.databinding.datagrid.api.filter
Class Filter

Object
  extended by Filter
All Implemented Interfaces:
Serializable

public class Filter
extends Object
implements Serializable

The Filter class is a JavaBean that abstractly represents the data needed to calculate a filter for a data set. A filter consists of some String expression, a FilterOperation and a filter value. The mechanism for applying a filter to a data set is not provided here.

The filter expression is used to abstractly name some part of a data set to filter. The filter operation is used to describe the operation to use when performing filtering. The set of operations for available for use should be related to a subclass of the Filter type; there are no implicitly defined operations. The filter value is used to describe how to filter a given filter expression. For example, in an application performing filtering using SQL, a filter expression pet with a filter operation mapping to "equals" and a filter value of "dog" could be transformed into a SQL WHERE fragment as:

   WHERE pet = 'dog'
 
The Filter class simply provides an abstraction for a filter's metadata; the mechanism for performing this transformation from Filter instance to SQL fragment is not provided here.

In addition to the fundamental data fora Filter, two additional properties can be defined. The FilterOperationHint property can be used to reference a class of operation related to the hint. The FilterTypeHint property defines a hint for the type of data associated with the Filter's filter expression. This data can be used to handle quoting and type conversion for a given filter value. In the example above, a type hint of a FilterTypeHint.STRING can be used when constructing the SQL fragment in order to perform the correct quoting of the filter value.

See Also:
Serialized Form

Constructor Summary
Filter()
           
 
Method Summary
 String getFilterExpression()
          Get the filter expression for this filter
 FilterOperation getOperation()
          Get the filter operation for this filter
 FilterOperationHint getOperationHint()
          Get the operation hint for this filter
 FilterTypeHint getTypeHint()
          Get the type hint for this filter.
 Object getValue()
          Get the value for this filter.
 void setFilterExpression(String filterExpression)
          Set the filter expression for this filter
 void setOperation(FilterOperation filterOperation)
          Set the filter operation for this filter
 void setOperationHint(FilterOperationHint filterOperationHint)
          Set the operation hint for this filter
 void setTypeHint(FilterTypeHint typeHint)
          Set the type hint for this filter
 void setValue(Object value)
          Set the value for this filter.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
Method Detail

getTypeHint

public FilterTypeHint getTypeHint()
Get the type hint for this filter.

Returns:
the filter type hint

setTypeHint

public void setTypeHint(FilterTypeHint typeHint)
Set the type hint for this filter

Parameters:
typeHint - the filter type hint

setFilterExpression

public void setFilterExpression(String filterExpression)
Set the filter expression for this filter

Parameters:
filterExpression - the filter expression

getFilterExpression

public String getFilterExpression()
Get the filter expression for this filter

Returns:
the filter expression

setOperation

public void setOperation(FilterOperation filterOperation)
Set the filter operation for this filter

Parameters:
filterOperation - the filter operation

getOperation

public FilterOperation getOperation()
Get the filter operation for this filter

Returns:
the filter operation

getOperationHint

public FilterOperationHint getOperationHint()
Get the operation hint for this filter

Returns:
the filter operation hint

setOperationHint

public void setOperationHint(FilterOperationHint filterOperationHint)
Set the operation hint for this filter

Parameters:
filterOperationHint - the filter operation hint

setValue

public void setValue(Object value)
Set the value for this filter. Note, in the default implementation, the value must implement Serializable.

Parameters:
value - the value

getValue

public Object getValue()
Get the value for this filter.

Returns:
the value