Package org.apache.jackrabbit.oak.query
Class QueryFormatter
- java.lang.Object
-
- org.apache.jackrabbit.oak.query.QueryFormatter
-
public class QueryFormatter extends Object
Formatter for JCR queries in order to make them easier to read. Formatting is done on a best-effort basis. Warning: Care was taken to not add newlines inside string literals and so on, but there is still no guarantee that the formatted query is semantically equal to the original one. It is NOT recommended to run queries that are returned by these methods.
-
-
Constructor Summary
Constructors Constructor Description QueryFormatter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
format(@NotNull String query, String language)
Format the query into a more human-readable way, by adding newlines before keywords such as "where", "and", and "or".static boolean
isXPath(String query, String language)
Detect whether the query is an XPath query.
-
-
-
Method Detail
-
isXPath
public static boolean isXPath(String query, String language)
Detect whether the query is an XPath query.- Parameters:
query
- the querylanguage
- the language, if known, or null- Returns:
- true if xpath
-
format
public static String format(@NotNull @NotNull String query, String language)
Format the query into a more human-readable way, by adding newlines before keywords such as "where", "and", and "or".- Parameters:
query
- the query (may not be null)language
- the query language, or null if unknown- Returns:
- the formatted query
-
-