org.nuiton.wikitty.query
Class WikittyQueryParser

java.lang.Object
  extended by org.parboiled.BaseActions<V>
      extended by org.parboiled.BaseParser<Object>
          extended by org.nuiton.wikitty.query.WikittyQueryParser
All Implemented Interfaces:
org.parboiled.ContextAware<Object>

public class WikittyQueryParser
extends org.parboiled.BaseParser<Object>

Cette classe permet d'interpreter une requete faite textuellement en la convertisant en sa representation objet. Pour plus d'information reportez-vous à la documentation

Since:
3.3 Last update: $Date$ by : $Author$
Version:
$Revision$
Author:
poussin

Field Summary
protected  Map<String,String> alias
           
static String AND
           
static String AVG
           
static String BRACKET_CLOSE
           
static String BRACKET_OPEN
           
static String COMMA
           
static String COUNT
           
static String CURLY_BRACKET_CLOSE
           
static String CURLY_BRACKET_OPEN
           
static String EQUALS
           
static String FALSE
           
static String GREATER
           
static String GREATER_OR_EQUALS
           
 org.parboiled.Rule icAND
           
 org.parboiled.Rule icAVG
           
 org.parboiled.Rule icCOUNT
           
 org.parboiled.Rule icEXTENSION
           
 org.parboiled.Rule icFALSE
           
 org.parboiled.Rule icID
           
 org.parboiled.Rule icIN
           
 org.parboiled.Rule icLIKE
           
 org.parboiled.Rule icMAX
           
 org.parboiled.Rule icMIN
           
 org.parboiled.Rule icNOT
           
 org.parboiled.Rule icNULL
           
 org.parboiled.Rule icOR
           
 org.parboiled.Rule icSELECT
           
 org.parboiled.Rule icSUM
           
 org.parboiled.Rule icTO
           
 org.parboiled.Rule icTRUE
           
 org.parboiled.Rule icUNLIKE
           
 org.parboiled.Rule icWHERE
           
static String IN
           
static String LESS
           
static String LESS_OR_EQUALS
           
static String LIKE
           
static String LITERAL_CLOSE
           
static String LITERAL_OPEN
           
static String MAX
           
static String MIN
           
static String NOT
           
static String NOT_EQUALS
           
static String NULL
           
static String OR
           
static String SELECT
           
static String SQUARE_BRACKET_CLOSE
           
static String SQUARE_BRACKET_OPEN
           
static String SUM
           
static String TO
           
static String TRUE
           
static String UNLIKE
           
static String WHERE
           
 
Fields inherited from class org.parboiled.BaseParser
ANY, DEDENT, EMPTY, EOI, INDENT, NOTHING
 
Constructor Summary
WikittyQueryParser()
           
 
Method Summary
 WikittyQueryParser addAlias(String aliasName, String aliasValue)
           
 Map<String,String> getAlias()
           
static WikittyQuery parse(String queryString)
          Parse query without alias
static WikittyQuery parse(String queryString, Map<String,String> alias)
          Parse query and use alias in argument
 WikittyQuery parseQuery(String queryString)
          Parse query and use alias added with addAlias(java.lang.String, java.lang.String) or setAlias(java.util.Map)
protected  String removeQuote(String s)
          Remove quote at beginning and ending of String in parameter if necessary "toto" return toto "toto return "toto toto return toto" to"to return to"to
 WikittyQueryParser setAlias(Map<String,String> alias)
           
protected  Element toElement(String v)
          can be field, extension name or id element
 
Methods inherited from class org.parboiled.BaseParser
ACTION, AnyOf, AnyOf, AnyOf, Ch, CharRange, FirstOf, FirstOf, fromCharArray, fromCharLiteral, fromStringLiteral, IgnoreCase, IgnoreCase, IgnoreCase, newInstance, NoneOf, NoneOf, OneOrMore, OneOrMore, Optional, Optional, Sequence, Sequence, String, String, Test, Test, TestNot, TestNot, toRule, toRules, ZeroOrMore, ZeroOrMore
 
Methods inherited from class org.parboiled.BaseActions
currentChar, currentIndex, drop, drop, dup, getContext, hasError, inPredicate, match, matchedChar, matchEnd, matchLength, matchOrDefault, matchRange, matchStart, nodeSuppressed, peek, peek, poke, poke, pop, pop, position, push, push, pushAll, setContext, swap, swap3, swap4, swap5, swap6
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVG

public static final String AVG
See Also:
Constant Field Values

COUNT

public static final String COUNT
See Also:
Constant Field Values

MAX

public static final String MAX
See Also:
Constant Field Values

MIN

public static final String MIN
See Also:
Constant Field Values

SUM

public static final String SUM
See Also:
Constant Field Values

SELECT

public static final String SELECT
See Also:
Constant Field Values

WHERE

public static final String WHERE
See Also:
Constant Field Values

IN

public static final String IN
See Also:
Constant Field Values

LITERAL_CLOSE

public static final String LITERAL_CLOSE
See Also:
Constant Field Values

LITERAL_OPEN

public static final String LITERAL_OPEN
See Also:
Constant Field Values

NULL

public static final String NULL
See Also:
Constant Field Values

TO

public static final String TO
See Also:
Constant Field Values

FALSE

public static final String FALSE
See Also:
Constant Field Values

TRUE

public static final String TRUE
See Also:
Constant Field Values

UNLIKE

public static final String UNLIKE
See Also:
Constant Field Values

AND

public static final String AND
See Also:
Constant Field Values

COMMA

public static final String COMMA
See Also:
Constant Field Values

CURLY_BRACKET_CLOSE

public static final String CURLY_BRACKET_CLOSE
See Also:
Constant Field Values

CURLY_BRACKET_OPEN

public static final String CURLY_BRACKET_OPEN
See Also:
Constant Field Values

EQUALS

public static final String EQUALS
See Also:
Constant Field Values

GREATER

public static final String GREATER
See Also:
Constant Field Values

GREATER_OR_EQUALS

public static final String GREATER_OR_EQUALS
See Also:
Constant Field Values

LESS

public static final String LESS
See Also:
Constant Field Values

LESS_OR_EQUALS

public static final String LESS_OR_EQUALS
See Also:
Constant Field Values

LIKE

public static final String LIKE
See Also:
Constant Field Values

NOT

public static final String NOT
See Also:
Constant Field Values

NOT_EQUALS

public static final String NOT_EQUALS
See Also:
Constant Field Values

OR

public static final String OR
See Also:
Constant Field Values

BRACKET_CLOSE

public static final String BRACKET_CLOSE
See Also:
Constant Field Values

BRACKET_OPEN

public static final String BRACKET_OPEN
See Also:
Constant Field Values

SQUARE_BRACKET_CLOSE

public static final String SQUARE_BRACKET_CLOSE
See Also:
Constant Field Values

SQUARE_BRACKET_OPEN

public static final String SQUARE_BRACKET_OPEN
See Also:
Constant Field Values

icEXTENSION

public org.parboiled.Rule icEXTENSION

icID

public org.parboiled.Rule icID

icNOT

public org.parboiled.Rule icNOT

icAND

public org.parboiled.Rule icAND

icOR

public org.parboiled.Rule icOR

icAVG

public org.parboiled.Rule icAVG

icCOUNT

public org.parboiled.Rule icCOUNT

icMAX

public org.parboiled.Rule icMAX

icMIN

public org.parboiled.Rule icMIN

icSUM

public org.parboiled.Rule icSUM

icSELECT

public org.parboiled.Rule icSELECT

icWHERE

public org.parboiled.Rule icWHERE

icIN

public org.parboiled.Rule icIN

icTO

public org.parboiled.Rule icTO

icFALSE

public org.parboiled.Rule icFALSE

icTRUE

public org.parboiled.Rule icTRUE

icLIKE

public org.parboiled.Rule icLIKE

icUNLIKE

public org.parboiled.Rule icUNLIKE

icNULL

public org.parboiled.Rule icNULL

alias

protected Map<String,String> alias
Constructor Detail

WikittyQueryParser

public WikittyQueryParser()
Method Detail

getAlias

public Map<String,String> getAlias()

setAlias

public WikittyQueryParser setAlias(Map<String,String> alias)

addAlias

public WikittyQueryParser addAlias(String aliasName,
                                   String aliasValue)

parseQuery

public WikittyQuery parseQuery(String queryString)
Parse query and use alias added with addAlias(java.lang.String, java.lang.String) or setAlias(java.util.Map)

Parameters:
queryString - query to parse
Returns:

parse

public static WikittyQuery parse(String queryString)
Parse query without alias

Parameters:
queryString - query to parse
Returns:

parse

public static WikittyQuery parse(String queryString,
                                 Map<String,String> alias)
Parse query and use alias in argument

Parameters:
queryString - query to parse
alias - alias to used to change query
Returns:

toElement

protected Element toElement(String v)
can be field, extension name or id element

Parameters:
v -
Returns:

removeQuote

protected String removeQuote(String s)
Remove quote at beginning and ending of String in parameter if necessary
  • "toto" return toto
  • "toto return "toto
  • toto return toto"
  • to"to return to"to

    Parameters:
    s -
    Returns:


  • Copyright © 2009-2012 CodeLutin. All Rights Reserved.