dk.eobjects.metamodel.query
Class FilterItem

Package class diagram package FilterItem
java.lang.Object
  extended by dk.eobjects.metamodel.query.FilterItem
All Implemented Interfaces:
IQueryItem, java.io.Serializable, java.lang.Cloneable

public class FilterItem
extends java.lang.Object
implements IQueryItem, java.lang.Cloneable

Represents a filter in a query that resides either within a WHERE clause or a HAVING clause

See Also:
FilterClause, OperatorType, Serialized Form

Constructor Summary
FilterItem(FilterItem... items)
          Creates a composite filter item based on other filter items.
FilterItem(SelectItem selectItem, OperatorType operator, java.lang.Object operand)
          Creates a single filter item based on a SelectItem, an operator and an operand.
FilterItem(java.lang.String expression)
          Creates a single unvalidated filter item based on a expression.
 
Method Summary
protected  FilterItem clone()
           
 boolean equals(java.lang.Object obj)
           
 boolean evaluate(Row row)
          Does a "manual" evaluation, useful for CSV data and alike, where queries cannot be created.
 java.lang.String getExpression()
           
 java.lang.Object getOperand()
           
 OperatorType getOperator()
           
 Query getQuery()
           
 SelectItem getSelectItem()
           
 int hashCode()
           
 boolean isReferenced(Column column)
           
 FilterItem setOperand(java.lang.Object operand)
           
 FilterItem setOperator(OperatorType operator)
           
 FilterItem setQuery(Query query)
           
 FilterItem setSelectItem(SelectItem selectItem)
           
 java.lang.String toString()
          Parses the constraint as a SQL Where-clause
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilterItem

public FilterItem(SelectItem selectItem,
                  OperatorType operator,
                  java.lang.Object operand)
           throws java.lang.IllegalArgumentException
Creates a single filter item based on a SelectItem, an operator and an operand.

Parameters:
selectItem - the selectItem to put constraints on, cannot be null
operator - The operator to use. Can be OperatorType.EQUALS_TO, OperatorType.DIFFERENT_FROM, OperatorType.GREATER_THAN,OperatorType.SMALLER_THAN
operand - The operand. Can be a constant like null or a String, a Number, a Boolean, a Date, a Time, a DateTime. Or another SelectItem
Throws:
java.lang.IllegalArgumentException - if the SelectItem is null or if the combination of operator and operand does not make sense.

FilterItem

public FilterItem(java.lang.String expression)
Creates a single unvalidated filter item based on a expression. Expression based filters are typically NOT datastore-neutral but are available for special "hacking" needs. Expression based filters can only be used for JDBC based datastores since they are translated directly into SQL.

Parameters:
expression - An expression to use for the filter, for example "YEAR(my_date) = 2008".

FilterItem

public FilterItem(FilterItem... items)
Creates a composite filter item based on other filter items. Each provided filter items will be OR'ed meaning that if one of the evaluates as true, then the composite filter will be evaluated as true

Parameters:
items - the items to include in the composite
Method Detail

getSelectItem

public SelectItem getSelectItem()

setSelectItem

public FilterItem setSelectItem(SelectItem selectItem)

getOperator

public OperatorType getOperator()

setOperator

public FilterItem setOperator(OperatorType operator)

getOperand

public java.lang.Object getOperand()

setOperand

public FilterItem setOperand(java.lang.Object operand)

getExpression

public java.lang.String getExpression()

getQuery

public Query getQuery()
Specified by:
getQuery in interface IQueryItem

setQuery

public FilterItem setQuery(Query query)
Specified by:
setQuery in interface IQueryItem

toString

public java.lang.String toString()
Parses the constraint as a SQL Where-clause

Overrides:
toString in class java.lang.Object

evaluate

public boolean evaluate(Row row)
Does a "manual" evaluation, useful for CSV data and alike, where queries cannot be created.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

protected FilterItem clone()
Overrides:
clone in class java.lang.Object

isReferenced

public boolean isReferenced(Column column)


Copyright © 2007-2010. All Rights Reserved.