Constructor and Description |
---|
SQLParser(Pattern pattern)
Creates a new SQLParser using the given Pattern object
|
SQLParser(java.lang.String pattern)
Creates a new SQLParser using the given pattern string to create a Pattern object
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getList(java.lang.String name)
Gets all the values of a variable as type String
|
java.lang.String |
getRawText()
Gets the raw text as it was before being parsed
|
java.lang.String |
getType()
Gets the type of the SQL command
|
java.lang.String |
getVariable(java.lang.String name)
Gets the value of a variable as type String
|
java.lang.String |
getVariable(java.lang.String name,
java.lang.String defaultValue)
Gets the value of a variable as type String
|
int |
getVariableInt(java.lang.String name,
int defaultValue)
Gets a parsed variable as type integer
|
long |
getVariableLong(java.lang.String name,
long defaultValue)
Gets a parsed variable value as type long
|
boolean |
hasKeyWord(java.lang.String word)
Does the parsed SQL have the given keyword
|
void |
parse(java.lang.String text)
Parse the given text as SQL
|
public SQLParser(@Nonnull java.lang.String pattern)
pattern
- the pattern string to create a parser forpublic SQLParser(@Nonnull Pattern pattern)
pattern
- the Pattern to use when parsing@CheckReturnValue @Nonnull public java.lang.String getType()
@CheckReturnValue public boolean hasKeyWord(@Nonnull java.lang.String word) throws java.lang.Exception
hasKeyWord
in interface Parser
word
- the key word to check forjava.lang.Exception
- a serious problempublic final void parse(@Nonnull java.lang.String text) throws java.lang.Exception
@CheckReturnValue @Nonnull public java.lang.String getRawText()
getRawText
in interface Parser
@CheckReturnValue public int getVariableInt(@Nonnull java.lang.String name, int defaultValue) throws java.lang.Exception
getVariableInt
in interface Parser
name
- the name of the variable to getdefaultValue
- the default value if the variable is blankjava.lang.Exception
- a serious problem@CheckReturnValue public long getVariableLong(@Nonnull java.lang.String name, long defaultValue) throws java.lang.Exception
getVariableLong
in interface Parser
name
- the name of the variable to getdefaultValue
- the default value if the variable is blankjava.lang.Exception
- a serious problem@CheckReturnValue @Nullable public java.lang.String getVariable(@Nonnull java.lang.String name, @Nullable java.lang.String defaultValue) throws java.lang.Exception
getVariable
in interface Parser
name
- the name of the variable to getdefaultValue
- the default value if the variable is blankjava.lang.Exception
- a serious problem@CheckReturnValue @Nullable public java.lang.String getVariable(@Nonnull java.lang.String name) throws java.lang.Exception
getVariable
in interface Parser
name
- the name of the variable to getjava.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public java.lang.String[] getList(@Nonnull java.lang.String name) throws java.lang.Exception
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.