Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.josql.filters
Class JoSQLFileFilter  view JoSQLFileFilter download JoSQLFileFilter.java

java.lang.Object
  extended byorg.josql.filters.AbstractJoSQLFilter
      extended byorg.josql.filters.JoSQLFileFilter
All Implemented Interfaces:
java.io.FileFilter

public class JoSQLFileFilter
extends AbstractJoSQLFilter
implements java.io.FileFilter

A java.io.FileFilter that uses a JoSQL statement to provide the filtering. The value returned by the accept(File) 55 method is determined by executing the WHERE clause of a JoSQL statement on each File passed in.

Since this uses a sub-set of the JoSQL functionality certain restrictions apply:

Examples:

   SELECT *
   FROM   java.io.File
   WHERE  name $LIKE '%.html'
   AND    lastModified > toDateMillis 55 ('12-04-2004')
   AND    file
 

Last Modified By: $Author: barrygently $
Last Modified On: $Date: 2005/01/07 17:10:40 $
Current Revision: $Revision: 1.1 $


Field Summary
 
Fields inherited from class org.josql.filters.AbstractJoSQLFilter
badQuery, exp, q
 
Constructor Summary
JoSQLFileFilter(org.josql.Query q)
          Init this file filter with the query already built and parsed.
JoSQLFileFilter(java.lang.String q)
          Init this file filter with the query.
 
Method Summary
 boolean accept(java.io.File f)
          Apply the WHERE clause of the statement to the java.io.File passed in.
 boolean accept(java.lang.Object o)
           
 java.lang.Class getExpectedClass()
          Always returns java.io.File.
 
Methods inherited from class org.josql.filters.AbstractJoSQLFilter
getException, getQuery, setQuery, setQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoSQLFileFilter

public JoSQLFileFilter(java.lang.String q)
                throws org.josql.QueryParseException
Init this file filter with the query.


JoSQLFileFilter

public JoSQLFileFilter(org.josql.Query q)
                throws java.lang.IllegalStateException,
                       org.josql.QueryParseException
Init this file filter with the query already built and parsed.

Method Detail

accept

public boolean accept(java.lang.Object o)
Specified by:
accept in class AbstractJoSQLFilter

accept

public boolean accept(java.io.File f)
Apply the WHERE clause of the statement to the java.io.File 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 files (since it is likely that the WHERE clause will fail for all File objects). You can get access to exception by using: AbstractJoSQLFilter.getException() 55 .

Specified by:
accept in interface java.io.FileFilter

getExpectedClass

public java.lang.Class getExpectedClass()
Always returns java.io.File.

Specified by:
getExpectedClass in class AbstractJoSQLFilter