Apache CXF API

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

java.lang.Object
  extended by org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionParser<T>
      extended by org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser<T>
Type Parameters:
T - type of search condition.
All Implemented Interfaces:
SearchConditionParser<T>

public class FiqlParser<T>
extends AbstractSearchConditionParser<T>

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 Map<ConditionType,String> CONDITION_MAP
           
static String EQ
           
static String EXTENSION_COUNT
           
protected static String EXTENSION_COUNT_OPEN
           
static String GE
           
static String GT
           
static String LE
           
static String LT
           
static String NEQ
           
static String OR
           
static String SUPPORT_SINGLE_EQUALS
           
 
Fields inherited from class org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionParser
beanPropertiesMap, beanspector, conditionClass, contextProperties
 
Constructor Summary
FiqlParser(Class<T> tclass)
          Creates FIQL parser.
FiqlParser(Class<T> tclass, Map<String,String> contextProperties)
          Creates FIQL parser.
FiqlParser(Class<T> tclass, Map<String,String> contextProperties, Map<String,String> beanProperties)
          Creates FIQL parser.
 
Method Summary
protected  boolean isCount(String propName)
           
 SearchCondition<T> parse(String fiqlExpression)
          Parses expression and builds search filter.
 
Methods inherited from class org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionParser
getActualSetterName, getSetter, getTypeInfo, parseType
 
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

CONDITION_MAP

public static final Map<ConditionType,String> CONDITION_MAP

SUPPORT_SINGLE_EQUALS

public static final String SUPPORT_SINGLE_EQUALS
See Also:
Constant Field Values

EXTENSION_COUNT

public static final String EXTENSION_COUNT
See Also:
Constant Field Values

EXTENSION_COUNT_OPEN

protected static final String EXTENSION_COUNT_OPEN
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 -

FiqlParser

public FiqlParser(Class<T> tclass,
                  Map<String,String> contextProperties,
                  Map<String,String> beanProperties)
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 SearchParseException
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:
SearchParseException - when expression does not follow FIQL grammar

isCount

protected boolean isCount(String propName)
Overrides:
isCount in class AbstractSearchConditionParser<T>

Apache CXF API

Apache CXF