public final class ExpressionTools extends Object
Modifier and Type | Field and Description |
---|---|
static Object[] |
EMPTY_ARRAY
The constant of an empty array.
|
static String |
EMPTY_STRING
The constant for an empty string.
|
static String[] |
EMPTY_STRING_ARRAY
The constant of an empty String array.
|
Modifier and Type | Method and Description |
---|---|
static String |
escape(CharSequence value,
int[] position)
Converts the escape characters contained in the given
CharSequence to their literal
representation. |
static boolean |
isParameter(char character)
Determines whether the given character is the character used to identify an input parameter,
either a named parameter or position parameter.
|
static boolean |
isQuote(char character)
Determines whether the given character is the single or double quote.
|
static String |
parseLiteral(WordParser wordParser)
Retrieves the first word from the given text starting at the specified position.
|
static int |
repositionCursor(CharSequence query1,
int position1,
CharSequence query2)
Re-adjusts the given position, which is based on query1, by making sure it is
pointing at the same position within query2.
|
static boolean |
stringIsEmpty(CharSequence text)
Determines whether the specified string is
null , empty, or contains only
whitespace characters. |
static boolean |
stringIsNotEmpty(CharSequence text)
Determines whether the specified string is NOT
null , NOT empty, or contains at
least one non-whitespace character. |
static String |
unescape(CharSequence value,
int[] position)
Converts the string representation of the escape characters contained by the given
CharSequence into the actual escape characters. |
static String |
unquote(String text)
Returns the string literal without the single or double quotes.
|
static boolean |
valuesAreDifferent(Object value1,
Object value2)
Determines whether the values are different, with the appropriate
null checks. |
static boolean |
valuesAreEqual(Object value1,
Object value2)
Determines whether the values are equal or equivalent, with the appropriate
null
checks. |
public static final Object[] EMPTY_ARRAY
public static final String EMPTY_STRING
public static final String[] EMPTY_STRING_ARRAY
public static String escape(CharSequence value, int[] position)
CharSequence
to their literal
representation. For example, '\b' is converted to '\\b'.value
- The sequence of characters to convert any escape characterposition
- This is a one element array that needs to be adjusted when an escape
character is convertedpublic static boolean isParameter(char character)
character
- The character to check if it's a parametertrue
if the given character is either : or ?; false
otherwisepublic static boolean isQuote(char character)
character
- The character to check if it's a quotetrue
if the given character is either ' or "; false
otherwisepublic static String parseLiteral(WordParser wordParser)
text
- The text from which the first word will be retrievedposition
- The position of the cursor where to start retrieving the wordpublic static int repositionCursor(CharSequence query1, int position1, CharSequence query2)
query1
- The query associated to the positionposition1
- The position within query1query2
- The query for which the position might need adjustmentpublic static boolean stringIsEmpty(CharSequence text)
null
, empty, or contains only
whitespace characters.text
- The sequence of character to test if it is null
or only contains
whitespacetrue
if the given string is null
or only contains whitespace;
false
otherwisepublic static boolean stringIsNotEmpty(CharSequence text)
null
, NOT empty, or contains at
least one non-whitespace character.text
- The sequence of character to test if it is NOT null
or does not only
contain whitespacetrue
if the given string is NOT null
or has at least one
non-whitespace character; false
otherwisepublic static String unescape(CharSequence value, int[] position)
CharSequence
into the actual escape characters. For example, the string '\\b' is converted
into the character value '\b'.value
- The sequence of characters to convert to an escaped versionposition
- This is a one element array that needs to be adjusted when an escape
character is convertedpublic static String unquote(String text)
text
- The original text to unquote if it has ' at the beginning and the endpublic static boolean valuesAreDifferent(Object value1, Object value2)
null
checks.value1
- The first value to check for equality and equivalencyvalue2
- The second value to check for equality and equivalencytrue
if both values are different; true
if they are both
null
, equal or equivalentpublic static boolean valuesAreEqual(Object value1, Object value2)
null
checks.value1
- The first value to check for equality and equivalencyvalue2
- The second value to check for equality and equivalencytrue
if both values are null
, equal or equivalent;
false
otherwiseEclipseLink 2.3.2, "build v20111125-r10461" API Reference