public final class JqlStringSupportImpl extends Object implements JqlStringSupport
The JQL grammar depends on the implementation isReservedString(java.lang.String)
method from this class. The other methods
depend upon the definitions within the JQL grammar (Jql.g). Changing the grammar will likely require changing this
class.
Modifier and Type | Field and Description |
---|---|
static Set<String> |
RESERVED_WORDS |
Constructor and Description |
---|
JqlStringSupportImpl(JqlQueryParser parser) |
Modifier and Type | Method and Description |
---|---|
static String |
decode(String string)
Remove escaping JQL escaping from the passed string.
|
static String |
encodeAsQuotedString(String string)
Encode the passed string into a valid JQL encoded quoted string.
|
static String |
encodeAsQuotedString(String string,
boolean escapeNewline)
Encode the passed string into a valid JQL encoded quoted string.
|
static String |
encodeCharacter(char character)
Encode the passed character so that it may be used in JQL.
|
static String |
encodeCharacterForce(char character)
Escape the passed character so that it may be used in JQL.
|
String |
encodeFieldName(String fieldName)
Encode the passed string into a safe JQL field name.
|
String |
encodeFunctionArgument(String argument)
Encode the passed string into a safe JQL function argument.
|
String |
encodeFunctionName(String functionName)
Encode the passed string into a safe JQL function name.
|
String |
encodeStringValue(String value)
Encode the passed string value into a safe JQL value if necessary.
|
String |
encodeValue(String value)
Encode the passed string value into a safe JQL value if necessary.
|
String |
generateJqlString(Clause clause)
Generates a JQL string representation for the passed clause.
|
String |
generateJqlString(Query query)
Generates a JQL string representation for the passed query.
|
Set<String> |
getJqlReservedWords() |
static boolean |
isJqlControl(char c)
Tells if caller if the passed character is considered a control character by JQL.
|
static boolean |
isReservedString(String string)
Tell the caller if the passed string is a reserved JQL string.
|
public JqlStringSupportImpl(JqlQueryParser parser)
public Set<String> getJqlReservedWords()
getJqlReservedWords
in interface JqlStringSupport
public String encodeStringValue(String value)
JqlStringSupport
encodeStringValue
in interface JqlStringSupport
value
- the value to encode.public String encodeValue(String value)
JqlStringSupport
JqlStringSupport.encodeStringValue(String)
since it will not add quotes around
long values.encodeValue
in interface JqlStringSupport
value
- the value to encode.public String encodeFunctionArgument(String argument)
JqlStringSupport
encodeFunctionArgument
in interface JqlStringSupport
argument
- the string to encode.public String encodeFunctionName(String functionName)
JqlStringSupport
encodeFunctionName
in interface JqlStringSupport
functionName
- the string to encode.public String encodeFieldName(String fieldName)
JqlStringSupport
encodeFieldName
in interface JqlStringSupport
fieldName
- the string to encode.public String generateJqlString(Query query)
JqlStringSupport
Query.getQueryString()
is completely ignored if it exists. The returned JQL is automatically escaped as necessary.generateJqlString
in interface JqlStringSupport
query
- the query. Cannot be null.public String generateJqlString(Clause clause)
JqlStringSupport
generateJqlString
in interface JqlStringSupport
clause
- the clause. Cannot be null.public static String decode(String string) throws IllegalArgumentException
string
- the string to decode.IllegalArgumentException
- if the input string contains invalid escape sequences.public static String encodeAsQuotedString(String string)
string
- the string to encode.public static String encodeAsQuotedString(String string, boolean escapeNewline)
string
- the string to encode.escapeNewline
- should escape and newline characters be escaped.public static String encodeCharacterForce(char character)
character
- the character to escape.public static String encodeCharacter(char character)
character
- the character to encode.public static boolean isReservedString(String string)
string
- the word to test.public static boolean isJqlControl(char c)
NOTE: This method duplicates some logic from the grammar. If the grammar changes then this method will also need to change. We have replicated the logic for effeciency reasons.
c
- the character to check.Copyright © 2002-2015 Atlassian. All Rights Reserved.