Apache CXF API

org.apache.cxf.jaxrs.ext.search
Class FiqlParser<T>

java.lang.Object
  extended by org.apache.cxf.jaxrs.ext.search.FiqlParser<T>
Type Parameters:
T - type of search condition.

public class FiqlParser<T>
extends Object

Parses FIQL expression to construct SearchCondition structure. Since this class operates on Java type T, not on XML structures "selectors" part of specification is not applicable; instead selectors describes getters of type T used as search condition type (see SimpleSearchCondition.isMet(Object) for details.


Field Summary
static String AND
           
static String DEFAULT_DATE_FORMAT
           
static String EQ
           
static String GE
           
static String GT
           
static String LE
           
static String LT
           
static String NEQ
           
static String OR
           
 
Constructor Summary
FiqlParser(Class<T> tclass)
          Creates FIQL parser.
FiqlParser(Class<T> tclass, Map<String,String> contextProperties)
          Creates FIQL parser.
 
Method Summary
 SearchCondition<T> parse(String fiqlExpression)
          Parses expression and builds search filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OR

public static final String OR
See Also:
Constant Field Values

AND

public static final String AND
See Also:
Constant Field Values

GT

public static final String GT
See Also:
Constant Field Values

GE

public static final String GE
See Also:
Constant Field Values

LT

public static final String LT
See Also:
Constant Field Values

LE

public static final String LE
See Also:
Constant Field Values

EQ

public static final String EQ
See Also:
Constant Field Values

NEQ

public static final String NEQ
See Also:
Constant Field Values

DEFAULT_DATE_FORMAT

public static final String DEFAULT_DATE_FORMAT
See Also:
Constant Field Values
Constructor Detail

FiqlParser

public FiqlParser(Class<T> tclass)
Creates FIQL parser.

Parameters:
tclass - - class of T used to create condition objects in built syntax tree. Class T must have accessible no-arg constructor and complementary setters to these used in FIQL expressions.

FiqlParser

public FiqlParser(Class<T> tclass,
                  Map<String,String> contextProperties)
Creates FIQL parser.

Parameters:
tclass - - class of T used to create condition objects in built syntax tree. Class T must have accessible no-arg constructor and complementary setters to these used in FIQL expressions.
contextProperties -
Method Detail

parse

public SearchCondition<T> parse(String fiqlExpression)
                         throws FiqlParseException
Parses expression and builds search filter. Names used in FIQL expression are names of getters/setters in type T.

Example:

 class Condition {
   public String getFoo() {...}
   public void setFoo(String foo) {...}
   public int getBar() {...}
   public void setBar(int bar) {...}
 }
 
 FiqlParser<Condition> parser = new FiqlParser<Condition>(Condition.class);
 parser.parse("foo==mystery*;bar=ge=10");
 

Parameters:
fiqlExpression - expression of filter.
Returns:
tree of SearchCondition objects representing runtime search structure.
Throws:
FiqlParseException - when expression does not follow FIQL grammar

Apache CXF API

Apache CXF