Class StringExpression

All Implemented Interfaces:
Expression<String>, Serializable
Direct Known Subclasses:
StringOperation, StringPath, StringTemplate

public abstract class StringExpression extends LiteralExpression<String>
StringExpression represents String expressions
Author:
tiwe
See Also:
  • Constructor Details

  • Method Details

    • as

      public StringExpression as(Path<String> alias)
      Description copied from class: SimpleExpression
      Create an alias for the expression
      Overrides:
      as in class ComparableExpression<String>
      Returns:
      alias expression
    • as

      public StringExpression as(String alias)
      Description copied from class: SimpleExpression
      Create an alias for the expression
      Overrides:
      as in class ComparableExpression<String>
      Returns:
      alias expression
    • append

      public StringExpression append(Expression<String> str)
      Create a concat(this, str) expression

      Get the concatenation of this and str

      Parameters:
      str - string to append
      Returns:
      this + str
    • append

      public StringExpression append(String str)
      Create a concat(this, str) expression

      Get the concatenation of this and str

      Parameters:
      str - string to append
      Returns:
      this + str
    • charAt

      Create a this.charAt(i) expression

      Get the character at the given index

      Parameters:
      i - zero based index
      Returns:
      this.charAt(i)
      See Also:
    • charAt

      public SimpleExpression<Character> charAt(int i)
      Create a this.charAt(i) expression

      Get the character at the given index

      Parameters:
      i - zero based index
      Returns:
      this.charAt(i)
      See Also:
    • concat

      public StringExpression concat(Expression<String> str)
      Create a concat(this, str) expression

      Get the concatenation of this and str

      Parameters:
      str - string to append
      Returns:
      this + str
    • concat

      public StringExpression concat(String str)
      Create a concat(this, str) expression

      Get the concatenation of this and str

      Parameters:
      str - string to append
      Returns:
      this + str
    • contains

      public BooleanExpression contains(Expression<String> str)
      Create a this.contains(str) expression

      Returns true if the given String is contained

      Parameters:
      str - string
      Returns:
      this.contains(str)
      See Also:
    • contains

      public BooleanExpression contains(String str)
      Create a this.contains(str) expression

      Returns true if the given String is contained

      Parameters:
      str - string
      Returns:
      this.contains(str)
      See Also:
    • containsIgnoreCase

      public BooleanExpression containsIgnoreCase(Expression<String> str)
      Create a this.containsIgnoreCase(str) expression

      Returns true if the given String is contained, compare case insensitively

      Parameters:
      str - string
      Returns:
      this.containsIgnoreCase(str) expression
    • containsIgnoreCase

      public BooleanExpression containsIgnoreCase(String str)
      Create a this.containsIgnoreCase(str) expression

      Returns true if the given String is contained, compare case insensitively

      Parameters:
      str - string
      Returns:
      this.containsIgnoreCase(str)
    • endsWith

      public BooleanExpression endsWith(Expression<String> str)
      Create a this.endsWith(str) expression

      Returns true if this ends with str

      Parameters:
      str - string
      Returns:
      this.endsWith(str)
      See Also:
    • endsWithIgnoreCase

      public BooleanExpression endsWithIgnoreCase(Expression<String> str)
      Create a this.endsWithIgnoreCase(str) expression

      Returns true if this ends with str, compares case insensitively

      Parameters:
      str - string
      Returns:
      this.endsWithIgnoreCase(str)
    • endsWith

      public BooleanExpression endsWith(String str)
      Create a this.endsWith(str) expression

      Returns true if this ends with str

      Parameters:
      str - string
      Returns:
      this.endsWith(str)
      See Also:
    • endsWithIgnoreCase

      public BooleanExpression endsWithIgnoreCase(String str)
      Create a this.endsWithIgnoreCase(str) expression

      Returns true if this ends with str, compares case insensitively

      Parameters:
      str - string
      Returns:
      this.endsWithIgnoreCase(str)
    • equalsIgnoreCase

      public BooleanExpression equalsIgnoreCase(Expression<String> str)
      Create a this.equalsIgnoreCase(str) expression

      Compares this StringExpression to another StringExpression, ignoring case considerations.

      Parameters:
      str - string
      Returns:
      this.equalsIgnoreCase(str)
      See Also:
    • equalsIgnoreCase

      public BooleanExpression equalsIgnoreCase(String str)
      Create a this.equalsIgnoreCase(str) expression

      Compares this StringExpression to another StringExpression, ignoring case considerations.

      Parameters:
      str - string
      Returns:
      this.equalsIgnoreCase(str)
      See Also:
    • indexOf

      public NumberExpression<Integer> indexOf(Expression<String> str)
      Create a this.indexOf(str) expression

      Get the index of the given substring in this String

      Parameters:
      str - string
      Returns:
      this.indexOf(str)
      See Also:
    • indexOf

      public NumberExpression<Integer> indexOf(String str)
      Create a this.indexOf(str) expression

      Get the index of the given substring in this String

      Parameters:
      str - string
      Returns:
      this.indexOf(str)
      See Also:
    • indexOf

      public NumberExpression<Integer> indexOf(String str, int i)
      Create a this.indexOf(str, i) expression

      Get the index of the given substring in this String, starting from the given index

      Parameters:
      str - string
      i - zero based index
      Returns:
      this.indexOf(str, i)
      See Also:
    • indexOf

      public NumberExpression<Integer> indexOf(Expression<String> str, int i)
      Create a this.indexOf(str) expression

      Get the index of the given substring in this String, starting from the given index

      Parameters:
      str - string
      i - zero based index
      Returns:
      this.indexOf(str)
    • isEmpty

      public BooleanExpression isEmpty()
      Create a this.isEmpty() expression

      Return true if this String is empty

      Returns:
      this.isEmpty()
      See Also:
    • isNotEmpty

      public BooleanExpression isNotEmpty()
      Create a !this.isEmpty() expression

      Return true if this String is not empty

      Returns:
      !this.isEmpty()
      See Also:
    • length

      public NumberExpression<Integer> length()
      Create a this.length() expression

      Return the length of this String

      Returns:
      this.length()
      See Also:
    • like

      public BooleanExpression like(String str)
      Create a this like str expression
      Parameters:
      str - string
      Returns:
      this like str
    • like

      public BooleanExpression like(Expression<String> str)
      Create a this like str expression
      Parameters:
      str - string
      Returns:
      this like str
    • likeIgnoreCase

      public BooleanExpression likeIgnoreCase(String str)
      Create a this like str expression ignoring case
      Parameters:
      str - string
      Returns:
      this like str
    • likeIgnoreCase

      public BooleanExpression likeIgnoreCase(Expression<String> str)
      Create a this like str expression ignoring case
      Parameters:
      str - string
      Returns:
      this like str
    • like

      public BooleanExpression like(String str, char escape)
      Create a this like str expression
      Parameters:
      str - string
      Returns:
      this like str
    • like

      public BooleanExpression like(Expression<String> str, char escape)
      Create a this like str expression
      Parameters:
      str - string
      Returns:
      this like str
    • likeIgnoreCase

      public BooleanExpression likeIgnoreCase(String str, char escape)
      Create a this like str expression ignoring case
      Parameters:
      str - string
      escape - escape character
      Returns:
      this like string
    • likeIgnoreCase

      public BooleanExpression likeIgnoreCase(Expression<String> str, char escape)
      Create a this like str expression ignoring case
      Parameters:
      str - string
      escape - escape character
      Returns:
      this like string
    • locate

      public NumberExpression<Integer> locate(Expression<String> str)
      Create a locate(str, this) expression

      Get the position of the given String in this String, the first position is 1

      Parameters:
      str - string
      Returns:
      locate(str, this)
    • locate

      public NumberExpression<Integer> locate(String str)
      Create a locate(str, this) expression

      Get the position of the given String in this String, the first position is 1

      Parameters:
      str - string
      Returns:
      locate(str, this)
    • locate

      Create a locate(str, this, start) expression

      Get the position of the given String in this String, the first position is 1

      Parameters:
      str - string
      start - start
      Returns:
      locate(str, this, start)
    • locate

      public NumberExpression<Integer> locate(String str, int start)
      Create a locate(str, this, start) expression

      Get the position of the given String in this String, the first position is 1

      Parameters:
      str - string
      start - start
      Returns:
      locate(str, this, start)
    • locate

      public NumberExpression<Integer> locate(String str, Expression<Integer> start)
      Create a locate(str, this, start) expression

      Get the position of the given String in this String, the first position is 1

      Parameters:
      str - string
      start - start
      Returns:
      locate(str, this, start)
    • lower

      public StringExpression lower()
      Create a this.toLowerCase() expression

      Get the lower case form

      Returns:
      this.toLowerCase()
      See Also:
    • matches

      public BooleanExpression matches(Expression<String> regex)
      Create a this.matches(regex) expression

      Return true if this String matches the given regular expression

      Some implementations such as Querydsl JPA will try to convert a regex expression into like form and will throw an Exception when this fails

      Parameters:
      regex - regular expression
      Returns:
      this.matches(right)
      See Also:
    • matches

      public BooleanExpression matches(String regex)
      Create a this.matches(regex) expression

      Return true if this String matches the given regular expression

      Some implementations such as Querydsl JPA will try to convert a regex expression into like form and will throw an Exception when this fails

      Parameters:
      regex - regular expression
      Returns:
      this.matches(regex)
      See Also:
    • max

      public StringExpression max()
      Create a max(this) expression

      Get the maximum value of this expression (aggregation)

      Overrides:
      max in class ComparableExpression<String>
      Returns:
      max(this)
    • min

      public StringExpression min()
      Create a min(this) expression

      Get the minimum value of this expression (aggregation)

      Overrides:
      min in class ComparableExpression<String>
      Returns:
      min(this)
    • notEqualsIgnoreCase

      public BooleanExpression notEqualsIgnoreCase(Expression<String> str)
      Create a !this.equalsIgnoreCase(str) expression

      Compares this StringExpression to another StringExpression, ignoring case considerations.

      Parameters:
      str - string
      Returns:
      !this.equalsIgnoreCase(str)
      See Also:
    • notEqualsIgnoreCase

      public BooleanExpression notEqualsIgnoreCase(String str)
      Create a !this.equalsIgnoreCase(str) expression

      Compares this StringExpression to another StringExpression, ignoring case considerations.

      Parameters:
      str - string
      Returns:
      !this.equalsIgnoreCase(str)
      See Also:
    • notLike

      public BooleanExpression notLike(String str)
      Create a this not like str expression
      Parameters:
      str - string
      Returns:
      this not like str
    • notLike

      public BooleanExpression notLike(Expression<String> str)
      Create a this not like str expression
      Parameters:
      str - string
      Returns:
      this not like str
    • notLike

      public BooleanExpression notLike(String str, char escape)
      Create a this not like str expression
      Parameters:
      str - string
      Returns:
      this not like str
    • notLike

      public BooleanExpression notLike(Expression<String> str, char escape)
      Create a this not like str expression
      Parameters:
      str - string
      Returns:
      this not like str
    • prepend

      public StringExpression prepend(Expression<String> str)
      Create a concat(str, this) expression

      Prepend the given String and return the result

      Parameters:
      str - string
      Returns:
      str + this
    • prepend

      public StringExpression prepend(String str)
      Create a concat(str, this) expression

      Prepend the given String and return the result

      Parameters:
      str - string
      Returns:
      str + this
    • startsWith

      public BooleanExpression startsWith(Expression<String> str)
      Create a this.startsWith(str) expression

      Return true if this starts with str

      Parameters:
      str - string
      Returns:
      this.startsWith(str)
      See Also:
    • startsWithIgnoreCase

      public BooleanExpression startsWithIgnoreCase(Expression<String> str)
      Create a this.startsWithIgnoreCase(str) expression
      Parameters:
      str - string
      Returns:
      this.startsWithIgnoreCase(str)
    • startsWith

      public BooleanExpression startsWith(String str)
      Create a this.startsWith(str) expression

      Return true if this starts with str

      Parameters:
      str - string
      Returns:
      this.startsWith(str)
      See Also:
    • startsWithIgnoreCase

      public BooleanExpression startsWithIgnoreCase(String str)
      Create a this.startsWithIgnoreCase(str) expression
      Parameters:
      str - string
      Returns:
      this.startsWithIgnoreCase(str)
    • stringValue

      public StringExpression stringValue()
      Description copied from class: LiteralExpression
      Create a cast to String expression
      Overrides:
      stringValue in class LiteralExpression<String>
      Returns:
      cast expression
      See Also:
    • substring

      public StringExpression substring(int beginIndex)
      Create a this.substring(beginIndex) expression
      Parameters:
      beginIndex - inclusive start index
      Returns:
      this.substring(beginIndex)
      See Also:
    • substring

      public StringExpression substring(int beginIndex, int endIndex)
      Create a this.substring(beginIndex, endIndex) expression
      Parameters:
      beginIndex - inclusive start index
      endIndex - exclusive end index
      Returns:
      this.substring(beginIndex, endIndex)
      See Also:
    • substring

      public StringExpression substring(Expression<Integer> beginIndex, int endIndex)
      Create a this.substring(beginIndex, endIndex) expression
      Parameters:
      beginIndex - inclusive start index
      endIndex - exclusive end index
      Returns:
      this.substring(beginIndex, endIndex)
      See Also:
    • substring

      public StringExpression substring(int beginIndex, Expression<Integer> endIndex)
      Create a this.substring(beginIndex, endIndex) expression
      Parameters:
      beginIndex - inclusive start index
      endIndex - exclusive end index
      Returns:
      this.substring(beginIndex, endIndex)
      See Also:
    • substring

      public StringExpression substring(Expression<Integer> beginIndex)
      Create a this.substring(beginIndex) expression
      Parameters:
      beginIndex - inclusive start index
      Returns:
      this.substring(beginIndex)
      See Also:
    • substring

      public StringExpression substring(Expression<Integer> beginIndex, Expression<Integer> endIndex)
      Create a this.substring(beginIndex, endIndex) expression
      Parameters:
      beginIndex - inclusive start index
      endIndex - exclusive end index
      Returns:
      this.substring(beginIndex, endIndex)
      See Also:
    • toLowerCase

      public StringExpression toLowerCase()
      Create a this.toLowerCase() expression

      Get the lower case form

      Returns:
      this.toLowerCase()
      See Also:
    • toUpperCase

      public StringExpression toUpperCase()
      Create a this.toUpperCase() expression

      Get the upper case form

      Returns:
      this.toUpperCase()
      See Also:
    • trim

      public StringExpression trim()
      Create a this.trim() expression

      Create a copy of the string, with leading and trailing whitespace omitted.

      Returns:
      this.trim()
      See Also:
    • upper

      public StringExpression upper()
      Create a this.toUpperCase() expression

      Get the upper case form

      Returns:
      this.toUpperCase()
      See Also:
    • nullif

      public StringExpression nullif(Expression<String> other)
      Create a nullif(this, other) expression
      Overrides:
      nullif in class ComparableExpression<String>
      Parameters:
      other -
      Returns:
      nullif(this, other)
    • nullif

      public StringExpression nullif(String other)
      Create a nullif(this, other) expression
      Overrides:
      nullif in class ComparableExpression<String>
      Parameters:
      other -
      Returns:
      nullif(this, other)
    • coalesce

      public StringExpression coalesce(Expression<String> expr)
      Create a coalesce(this, expr) expression
      Overrides:
      coalesce in class ComparableExpression<String>
      Parameters:
      expr - additional argument
      Returns:
      coalesce
    • coalesce

      public StringExpression coalesce(Expression<?>... exprs)
      Create a coalesce(this, exprs...) expression
      Overrides:
      coalesce in class ComparableExpression<String>
      Parameters:
      exprs - additional arguments
      Returns:
      coalesce
    • coalesce

      public StringExpression coalesce(String arg)
      Create a coalesce(this, arg) expression
      Overrides:
      coalesce in class ComparableExpression<String>
      Parameters:
      arg - additional argument
      Returns:
      coalesce
    • coalesce

      public StringExpression coalesce(String... args)
      Create a coalesce(this, args...) expression
      Overrides:
      coalesce in class ComparableExpression<String>
      Parameters:
      args - additional arguments
      Returns:
      coalesce