org.josql.filters
Class DefaultObjectFilter
java.lang.Object
org.josql.filters.AbstractJoSQLFilter
org.josql.filters.DefaultObjectFilter
public class DefaultObjectFilter
- extends AbstractJoSQLFilter
A general purpose object filter that uses a JoSQL statement to provide the filtering.
The value returned by the accept(Object)
method is determined by executing the
JoSQL WHERE clause passed in. A "wrapper" is created around the WHERE clause to make it
a fully-formed JoSQL statement.
Method Summary |
boolean |
accept(Object o)
Apply the WHERE clause of the statement to the object passed in. |
Class |
getExpectedClass()
Get the class the Query expects to operate on. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultObjectFilter
public DefaultObjectFilter(String w,
Class c)
throws QueryParseException
- Init this filter with the where clause, note the class specified will be used in the
FROM clause.
- Parameters:
w
- The where clause.c
- The class of the objects to filter.
- Throws:
QueryParseException
- If there is an issue with the parsing of the query.
DefaultObjectFilter
public DefaultObjectFilter(Query q)
throws IllegalStateException,
QueryParseException
- Init this file filter with the query already built and parsed.
- Parameters:
q
- The query.
- Throws:
IllegalStateException
- If the Query object has not been parsed.
QueryParseException
- If the FROM class is not File
.
accept
public boolean accept(Object o)
- Apply the WHERE clause of the statement to the object passed in.
If an exception is thrown by the execution of the WHERE clause the Query
is marked as "dirty" and the where clause is no longer executed on the passed in
objects (since it is likely that the WHERE clause will fail for all objects).
You can get access to exception by using:
AbstractJoSQLFilter.getException()
.
- Specified by:
accept
in class AbstractJoSQLFilter
- Parameters:
o
- The object to evaluate the WHERE on.
- Returns:
true
if the WHERE clause evaluates to true
.
getExpectedClass
public Class getExpectedClass()
- Get the class the Query expects to operate on.
- Specified by:
getExpectedClass
in class AbstractJoSQLFilter
- Returns:
- The class.
Copyright © 2008 Gary Bentley. All Rights Reserved.