org.josql.filters
Class AbstractJoSQLFilter

java.lang.Object
  extended by org.josql.filters.AbstractJoSQLFilter
Direct Known Subclasses:
DefaultObjectFilter, JoSQLFileFilter, JoSQLLogRecordFilter, StackTraceElementFilter

public abstract class AbstractJoSQLFilter
extends Object

This class just provides a base-abstract implementation that allow "Filters" to be built on top of it.


Field Summary
protected  boolean badQuery
           
protected  Exception exp
           
protected  Query q
           
 
Constructor Summary
protected AbstractJoSQLFilter()
          Protected constructor to allow sub-classes to init the query when they are ready.
  AbstractJoSQLFilter(Query q)
          Init this file filter with the query already built and parsed.
  AbstractJoSQLFilter(String q)
          Init this filter with the query.
 
Method Summary
abstract  boolean accept(Object o)
           
 void clearException()
          Clear any exception stored.
 Exception getException()
          Most "filter accept" methods do not allow for any exceptions to be thrown however since the execution of the WHERE clause on the object can cause the throwing of a QueryParseException it should be captured.
abstract  Class getExpectedClass()
          Should sub-classes should return the type that they expect to be present in a Query.
 Query getQuery()
          Get the Query we are using to process objects.
 void setQuery(Query q)
          Set a new Query object for use in this filter.
 void setQuery(String q)
          Set a new Query (string form) for use in this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

q

protected Query q

exp

protected Exception exp

badQuery

protected boolean badQuery
Constructor Detail

AbstractJoSQLFilter

protected AbstractJoSQLFilter()
Protected constructor to allow sub-classes to init the query when they are ready.


AbstractJoSQLFilter

public AbstractJoSQLFilter(String q)
                    throws QueryParseException
Init this filter with the query.

Parameters:
q - The query.
Throws:
QueryParseException - If there is an issue with the parsing of the query, or if the FROM class is not equal to the expected class.

AbstractJoSQLFilter

public AbstractJoSQLFilter(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 as expected.
Method Detail

getExpectedClass

public abstract Class getExpectedClass()
Should sub-classes should return the type that they expect to be present in a Query.

Returns:
The class that should be used in the Query for the filter.

accept

public abstract boolean accept(Object o)
                        throws UnsupportedOperationException
Throws:
UnsupportedOperationException

clearException

public void clearException()
Clear any exception stored.


getException

public Exception getException()
Most "filter accept" methods do not allow for any exceptions to be thrown however since the execution of the WHERE clause on the object can cause the throwing of a QueryParseException it should be captured. If the exception is thrown then this method will return it.

Returns:
The exception thrown by the execution of the WHERE clause in accept(Object) or by sub-class/interface specific methods, this may be null if no exception was thrown.

setQuery

public void setQuery(String q)
              throws QueryParseException
Set a new Query (string form) for use in this filter.

Parameters:
q - The Query to use.
Throws:
QueryParseException - If there is an issue with the parsing of the query, or if the FROM class is not as expected.

setQuery

public void setQuery(Query q)
              throws IllegalStateException,
                     QueryParseException
Set a new Query object for use in this filter.

Parameters:
q - The Query to use.
Throws:
IllegalStateException - If the Query object has not been parsed.
QueryParseException - If the FROM class is not as expected.

getQuery

public Query getQuery()
Get the Query we are using to process objects.

Returns:
The Query.


  Copyright © 2008 Gary Bentley. All Rights Reserved.