Expression object to parse its fragment of the query.
Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | WordParser.WordType
This enumeration determines the type of word that was scanned. |
| Modifier and Type | Field and Description |
|---|---|
| private int | cursor
The current position of the cursor within the JPQL query. |
| private final int | length
The length of the JPQL query. |
| private final CharSequence | text
The string representation of the JPQL query. |
| private WordParser. | wordType
When |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public char | Returns: The character retrieved from the string at the current cursor position or '\0' if the position is beyond the end of the textRetrieves the character at the current cursor position. |
| public char | Returns: The character retrieved from the string at the given position or '\0' if the position is beyond the end of the textThe position of the character to return position)Retrieves the character at the given cursor position. |
| public boolean | Returns: true if the character sequence represented by the argument is a suffix of
the query; false otherwiseThe position where the check stops endPosition, String The suffix is the text that is used to match it with the substring within the text suffix)Determines whether the query ends with the given suffix and the end position is the end of the range for testing. |
| public boolean | Returns: true if the character sequence represented by the argument is a suffix of
the query; false otherwiseThe position where the check stops endPosition, String The suffix is the text that is used to match it with the substring within the text suffix)Determines whether the query ends with the given suffix and the end position is the end of the range for testing. |
| public String | Returns: The word in which the cursor isRetrieves a word starting at the current position. |
| public String | Returns: The word in which the cursor isThe position where to retrieve the word position)Retrieves a word starting at the given position. |
| public WordParser. | Returns: The category of the word returned byword()Returns what the type of word |
| public boolean | Returns: true if the given character is one of the valid math symbols;
false otherwiseThe character to test if it's a math symbol character)Determines whether the given character is an arithmetic symbol, which is one of the following: { '>', '<', '/', '*', '-', '+', '=', '{'} . |
| public boolean | Returns: true if the given character is a delimiter; false otherwiseThe character to test character)Determines whether the given character is a delimiter. |
| public boolean | Returns: true if the given character is a digit; false otherwiseThe character to test if it's a digit character)Determines whether the given character is a character that can be used in a number. |
| public boolean | Returns: true if the position of the cursor is at the end of the text;
false otherwiseDetermines whether the position of the cursor is at the end of the text. |
| public boolean | Returns: true if the character can be part of a word; false if it is
not an alphanumeric character, which usually means is a whitespace, a delimiter or an
arithmetic symbolThe character used to determine if it should be part of a word or not character)Determines whether the given character is not considered to be part of a word (which is usually comprise of alphanumeric characters). |
| public int | |
| public void | moveBackward(CharSequence
The word used to determine how much to move the position forward word)Moves the position of the cursor by the length of the given word. |
| public void | moveBackward(int
The amount to remove from the current position position)Moves backward the position of the cursor by the given amount. |
| public String | Returns: The actual portion of the text that was skippedThe word used to determine how much to move the position forward word)Moves the position of the cursor by the length of the given word. |
| public String | Returns: The actual portion of the text that was skippedThe amount to add to the current position position)Moves forward the position of the cursor by the given amount. |
| public String | Returns: The actual portion of the text that was skippedThe word used to determine how much to move the position forward word)Moves the position of the cursor by the length of the given word and ignore any different in whitespace count. |
| public String | Returns: The numeric literal valueRetrieves the numeric literal that should be the current word to parse. |
| public String | Returns: The sub-string that is before the positionRetrieves a word before the current position of the cursor, which determines when the parsing stop. |
| public String | Returns: The sub-string that is before the positionThe position of the cursor position)Retrieves a word before the specified position, which determines when the parsing stop. |
| public int | Returns: The position, which is a smaller number or equal, than the given positionThe position from which the search ends position)Finds the beginning of the word and the given position is within that word. |
| public int | |
| private int | |
| private int | Returns: The first word contained in the text, if none could be found, then an empty string is returnedthe current position that will be used to parse the literal startPosition)Retrieves the first word from the given text starting at the specified position. |
| public void | setPosition(int
The new position of the cursor position)Manually sets the position of the cursor within the string. |
| public int | Returns: The number of whitespace removedRemoves the whitespace that starts the given text. |
| public boolean | Returns: true if the text starts with the given character at the current position;
false otherwiseThe possible character at the current position possibleCharacter)Determines whether the text starts with the given character. |
| public boolean | Returns: true if the character sequence represented by the argument is a prefix of
the text; false otherwiseThe prefix prefix)Tests whether the query starts with the specified prefix from the current position. |
| public boolean | Returns: true if the character sequence represented by the
argument is a prefix of the substring of this object starting at index startIndex;
false otherwiseThe prefix prefix, int Where to begin looking in the query startIndex)Tests whether the substring of the query beginning at the specified index starts with the specified prefix. |
| public boolean | Returns: true if the character at the current position is an arithmetic operator;
false otherwiseDetermines whether the character at the current position is one of the arithmetic operators: { '+', '-', '*', '/' }, |
| public Boolean | Returns: true if the text starts with a digit (we'll assume it is a digit if the
text starts with a digit or an arithmetic sign followed by a digit), false if it
starts with an arithmetic term (we'll assume it is a digit followed by a non-digit character);
otherwise returns nullDetermines if the text starts with a digit ( |
| public boolean | Returns: true if the text starts with the given text (case is ignored) and the
cursor is at the end of the text or is following by a word separator character; false
otherwiseThe JPQL identifier to match with the text at the current position identifier)Determines whether the text at the current position start with the following identifier. |
| public boolean | Returns: true if the text starts with the given text (case is ignored) and the
cursor is at the end of the text or is following by a word separator character; false
otherwiseThe JPQL identifier to match with the text at the current position identifier, int The position to start matching the characters position)Determines whether the text at the current position start with the following identifier. |
| public boolean | Returns: true if the text starts with the given character at the current position;
false otherwiseThe possible character at the current position possibleCharacter)Determines whether the text starts with the given character. |
| public boolean | Returns: true if the character sequence represented by the argument is a prefix of
the character sequence represented by this string; false otherwise. Note also
that true will be returned if the argument is an empty string or is equal to this
String object as determined by the equals(Object) methodThe prefix to test against prefix)Tests if the string starts with the specified prefix. |
| public boolean | Returns: true if the character sequence represented by the argument is a prefix of
the character sequence represented by this string; false otherwiseThe prefix to test against prefix, int Where to begin looking in this string offset)Tests if the string starts with the specified prefix. |
| public String | Returns: The remain of the string starting at the current positionReturns a substring that is within the current position of the cursor and the end of the text. |
| public String | Returns: The remain of the string starting at the given positionThe beginning of the substring, inclusive startIndex)Returns a substring that is within the given position and the end of the text. |
| public String | Returns: The remain of the string that is within the given positionsThe beginning of the substring, inclusive startIndex, int The end of the substring, exclusive endIndex)Returns a substring that is within the given positions. |
| public String | |
| public int | Returns: The count of consecutive whitespace found from the current positionCalculates the number of whitespace that are in the query. |
| public int | Returns: The count of consecutive whitespace found from the given positionThe position from where the scan starts position)Calculates the number of whitespace that are in the query. |
| public String | Returns: The first word contained in the text, if none could be found, then an empty string is returnedRetrieves the first word starting at the current position. |
| public int | Returns: The position where the current word endsReturns the position a word would end based on the current cursor position. |
| public int | Returns: The position where the current word endsThe position to start scanning the text position)Returns the position a word would end based on the given start position. |
| cursor | back to summary |
|---|---|
| private int cursor The current position of the cursor within the JPQL query. | |
| length | back to summary |
|---|---|
| private final int length The length of the JPQL query. | |
| text | back to summary |
|---|---|
| private final CharSequence text The string representation of the JPQL query. | |
| wordType | back to summary |
|---|---|
| private WordParser. When
| |
| WordParser | back to summary |
|---|---|
| public WordParser(CharSequence text) Creates a new
| |
| character | back to summary |
|---|---|
| public char character() Retrieves the character at the current cursor position.
| |
| character | back to summary |
|---|---|
| public char character(int position) Retrieves the character at the given cursor position.
| |
| endsWith | back to summary |
|---|---|
| public boolean endsWith(int endPosition, String suffix) Determines whether the query ends with the given suffix and the end position is the end of the range for testing.
| |
| endsWithIgnoreCase | back to summary |
|---|---|
| public boolean endsWithIgnoreCase(int endPosition, String suffix) Determines whether the query ends with the given suffix and the end position is the end of the range for testing. The case of the character is ignored.
| |
| entireWord | back to summary |
|---|---|
| public String entireWord() Retrieves a word starting at the current position. The text before and after the position will be part of the returned value. For instance, "SELECT AVG(e.age) FROM Employee e":
| |
| entireWord | back to summary |
|---|---|
| public String entireWord(int position) Retrieves a word starting at the given position. The text before and after the position will be part of the returned value. For instance, "SELECT AVG(e.age) FROM Employee e":
| |
| getWordType | back to summary |
|---|---|
| public WordParser. Returns what the type of word
| |
| isArithmeticSymbol | back to summary |
|---|---|
| public boolean isArithmeticSymbol(char character) Determines whether the given character is an arithmetic symbol, which is one of the following: { '>', '<', '/', '*', '-', '+', '=', '{'} .
| |
| isDelimiter | back to summary |
|---|---|
| public boolean isDelimiter(char character) Determines whether the given character is a delimiter. The delimiter are '(', ')' and ','.
| |
| isDigit | back to summary |
|---|---|
| public boolean isDigit(char character) Determines whether the given character is a character that can be used in a number. This only includes the numeric characters [0, 9] and the period character. This method should only be used to determine if a word starts with a digit character.
| |
| isTail | back to summary |
|---|---|
| public boolean isTail() Determines whether the position of the cursor is at the end of the text.
| |
| isWordSeparator | back to summary |
|---|---|
| public boolean isWordSeparator(char character) Determines whether the given character is not considered to be part of a word (which is usually comprise of alphanumeric characters).
| |
| length | back to summary |
|---|---|
| public int length() Returns the length of the string value.
| |
| moveBackward | back to summary |
|---|---|
| public void moveBackward(CharSequence word) Moves the position of the cursor by the length of the given word.
| |
| moveBackward | back to summary |
|---|---|
| public void moveBackward(int position) Moves backward the position of the cursor by the given amount.
| |
| moveForward | back to summary |
|---|---|
| public String moveForward(CharSequence word) Moves the position of the cursor by the length of the given word.
| |
| moveForward | back to summary |
|---|---|
| public String moveForward(int position) Moves forward the position of the cursor by the given amount.
| |
| moveForwardIgnoreWhitespace | back to summary |
|---|---|
| public String moveForwardIgnoreWhitespace(CharSequence word) Moves the position of the cursor by the length of the given word and ignore any different in whitespace count. If the text has more than one whitespace and the given word usually has one, then only one will be part of the returned substring.
| |
| numericLiteral | back to summary |
|---|---|
| public String numericLiteral() Retrieves the numeric literal that should be the current word to parse.
| |
| partialWord | back to summary |
|---|---|
| public String partialWord() Retrieves a word before the current position of the cursor, which determines when the parsing stop. For instance, "SELECT AVG(e.age) FROM Employee e":
| |
| partialWord | back to summary |
|---|---|
| public String partialWord(int position) Retrieves a word before the specified position, which determines when the parsing stop. For instance, "SELECT AVG(e.age) FROM Employee e":
| |
| partialWordStartPosition | back to summary |
|---|---|
| public int partialWordStartPosition(int position) Finds the beginning of the word and the given position is within that word. For instance, "SELECT AVG(e.age) FROM Employee e":
| |
| position | back to summary |
|---|---|
| public int position() Returns the current position of the cursor.
| |
| scanNumericLiteral | back to summary |
|---|---|
| private int scanNumericLiteral(int startPosition) | |
| scanStringLiteral | back to summary |
|---|---|
| private int scanStringLiteral(int startPosition) Retrieves the first word from the given text starting at the specified position.
| |
| setPosition | back to summary |
|---|---|
| public void setPosition(int position) Manually sets the position of the cursor within the string. If the position is a negative number, the position will be 0.
| |
| skipLeadingWhitespace | back to summary |
|---|---|
| public int skipLeadingWhitespace() Removes the whitespace that starts the given text.
| |
| startsWith | back to summary |
|---|---|
| public boolean startsWith(char possibleCharacter) Determines whether the text starts with the given character. The case of the character is not ignored.
| |
| startsWith | back to summary |
|---|---|
| public boolean startsWith(CharSequence prefix) Tests whether the query starts with the specified prefix from the current position.
| |
| startsWith | back to summary |
|---|---|
| public boolean startsWith(CharSequence prefix, int startIndex) Tests whether the substring of the query beginning at the specified index starts with the specified prefix.
| |
| startsWithArithmeticOperator | back to summary |
|---|---|
| public boolean startsWithArithmeticOperator() Determines whether the character at the current position is one of the arithmetic operators: { '+', '-', '*', '/' },
| |
| startsWithDigit | back to summary |
|---|---|
| public Boolean startsWithDigit() Determines if the text starts with a digit (
| |
| startsWithIdentifier | back to summary |
|---|---|
| public boolean startsWithIdentifier(CharSequence identifier) Determines whether the text at the current position start with the following identifier.
| |
| startsWithIdentifier | back to summary |
|---|---|
| public boolean startsWithIdentifier(CharSequence identifier, int position) Determines whether the text at the current position start with the following identifier.
| |
| startsWithIgnoreCase | back to summary |
|---|---|
| public boolean startsWithIgnoreCase(char possibleCharacter) Determines whether the text starts with the given character. The case of the character is ignored.
| |
| startsWithIgnoreCase | back to summary |
|---|---|
| public boolean startsWithIgnoreCase(CharSequence prefix) Tests if the string starts with the specified prefix. The case of the character is ignored.
| |
| startsWithIgnoreCase | back to summary |
|---|---|
| public boolean startsWithIgnoreCase(CharSequence prefix, int offset) Tests if the string starts with the specified prefix. The case of the character is ignored.
| |
| substring | back to summary |
|---|---|
| public String substring() Returns a substring that is within the current position of the cursor and the end of the text.
| |
| substring | back to summary |
|---|---|
| public String substring(int startIndex) Returns a substring that is within the given position and the end of the text.
| |
| substring | back to summary |
|---|---|
| public String substring(int startIndex, int endIndex) Returns a substring that is within the given positions.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| whitespaceCount | back to summary |
|---|---|
| public int whitespaceCount() Calculates the number of whitespace that are in the query. The check starts at the current position.
| |
| whitespaceCount | back to summary |
|---|---|
| public int whitespaceCount(int position) Calculates the number of whitespace that are in the query. The check starts at the current position.
| |
| word | back to summary |
|---|---|
| public String word() Retrieves the first word starting at the current position.
| |
| wordEndPosition | back to summary |
|---|---|
| public int wordEndPosition() Returns the position a word would end based on the current cursor position.
| |
| wordEndPosition | back to summary |
|---|---|
| public int wordEndPosition(int position) Returns the position a word would end based on the given start position.
| |
WordParser#word(), WordParser#wordEndPosition(), WordParser#wordEndPosition(int).
| Modifier and Type | Field and Description |
|---|---|
| public static final WordParser. | INPUT_PARAMETER
The word being scanned is an input parameter, it starts with either ':' or '?'. |
| public static final WordParser. | NUMERIC_LITERAL
The word being scanned is a numeric literal (decimal or hexadecimal number). |
| public static final WordParser. | STRING_LITERAL
The word being scanned is a string literal, it starts with either ''' or '"'. |
| public static final WordParser. | UNDEFINED
No word was scanned, this is usually set when the cursor is at the end of the text. |
| public static final WordParser. | WORD
The word being scanned anything else other than an input parameter, numeric literal or string literal. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static WordParser. | |
| public static WordParser. |
| INPUT_PARAMETER | back to summary |
|---|---|
| public static final WordParser. The word being scanned is an input parameter, it starts with either ':' or '?'. | |
| NUMERIC_LITERAL | back to summary |
|---|---|
| public static final WordParser. The word being scanned is a numeric literal (decimal or hexadecimal number). | |
| STRING_LITERAL | back to summary |
|---|---|
| public static final WordParser. The word being scanned is a string literal, it starts with either ''' or '"'. | |
| UNDEFINED | back to summary |
|---|---|
| public static final WordParser. No word was scanned, this is usually set when the cursor is at the end of the text. | |
| WORD | back to summary |
|---|---|
| public static final WordParser. The word being scanned anything else other than an input parameter, numeric literal or string literal. | |
| WordType | back to summary |
|---|---|
| private WordType() | |
| valueOf | back to summary |
|---|---|
| public static WordParser. | |
| values | back to summary |
|---|---|
| public static WordParser. | |