Class Escaper
java.lang.Object
org.springframework.data.relational.core.dialect.Escaper
Helper class encapsulating an escape character for LIKE queries and the actually usage of it in escaping
Strings.- Since:
- 2.0
- Author:
- Roman Chigvintsev, Mark Paluch
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionEscapes all special like characters (_,%) using the configured escape character.charReturns the escape character.static Escaperof(char escapeCharacter) Creates new instance of this class with the given escape character.withRewriteFor(String... chars) Apply theEscaperto the givenchars.
-
Field Details
-
DEFAULT
-
-
Method Details
-
of
Creates new instance of this class with the given escape character.- Parameters:
escapeCharacter- escape character- Returns:
- new instance of
Escaper. - Throws:
IllegalArgumentException- if escape character is one of special characters ('_' and '%')
-
withRewriteFor
Apply theEscaperto the givenchars.- Parameters:
chars- characters/char sequences that should be escaped.- Returns:
-
getEscapeCharacter
public char getEscapeCharacter()Returns the escape character.- Returns:
- the escape character to use.
-
escape
Escapes all special like characters (_,%) using the configured escape character.- Parameters:
value- value to be escaped- Returns:
- escaped value
-