Class StandardDialect.StandardExpressionFunctions

java.lang.Object
org.seasar.doma.jdbc.dialect.StandardDialect.StandardExpressionFunctions
All Implemented Interfaces:
ExpressionFunctions
Direct Known Subclasses:
Db2Dialect.Db2ExpressionFunctions, H212126Dialect.H212126ExpressionFunctions, HsqldbDialect.HsqldbExpressionFunctions, Mssql2008Dialect.Mssql2008ExpressionFunctions, MysqlDialect.MysqlExpressionFunctions, Oracle11Dialect.Oracle11ExpressionFunctions, PostgresDialect.PostgresExpressionFunctions, SqliteDialect.SqliteExpressionFunctions
Enclosing class:
StandardDialect

public static class StandardDialect.StandardExpressionFunctions extends Object implements ExpressionFunctions
A standard implementation of ExpressionFunctions.
  • Field Details

    • escapeChar

      protected final char escapeChar
      the escape character for the SQL LIKE operator
    • wildcards

      protected final char[] wildcards
      the wild card characters for the SQL LIKE operator
    • defaultWildcardReplacementPattern

      protected final Pattern defaultWildcardReplacementPattern
      the default pattern for escape wild card characters
    • defaultReplacement

      protected final String defaultReplacement
      the default replacement string for wild card characters
  • Constructor Details

    • StandardExpressionFunctions

      protected StandardExpressionFunctions()
    • StandardExpressionFunctions

      protected StandardExpressionFunctions(char[] wildcards)
      Parameters:
      wildcards - the wild card characters for the SQL LIKE operator
    • StandardExpressionFunctions

      protected StandardExpressionFunctions(char escapeChar, char[] wildcards)
      Parameters:
      escapeChar - the escape character for the SQL LIKE operator
      wildcards - the wild card characters for the SQL LIKE operator
    • StandardExpressionFunctions

      protected StandardExpressionFunctions(char escapeChar, char[] wildcards, Pattern defaultWildcardReplacementPattern, String defaultReplacement)
      Parameters:
      escapeChar - the escape character for the SQL LIKE operator
      wildcards - the wild card characters for the SQL LIKE operator
      defaultWildcardReplacementPattern - the default pattern for escape wild card characters
      defaultReplacement - the default replacement string for wild card characters
  • Method Details

    • escape

      public String escape(CharSequence text, char escapeChar)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using a specified escape character.
      Specified by:
      escape in interface ExpressionFunctions
      Parameters:
      text - the target text
      escapeChar - the escape character
      Returns:
      the escaped text
    • escape

      public String escape(CharSequence text)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using the default escape character.

      For example, a%b_ is converted to the a a$%b$_.

      Specified by:
      escape in interface ExpressionFunctions
      Parameters:
      text - the target text
      Returns:
      the escaped text
    • prefix

      public String prefix(CharSequence text)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using the default escape character '$' and generate a text to perform a prefix search for the SQL Like operator.

      For example, a%b_ is converted to the a a$%b$_%.

      Specified by:
      prefix in interface ExpressionFunctions
      Parameters:
      text - the prefix text
      Returns:
      the text for a prefix search
    • prefix

      public String prefix(CharSequence text, char escapeChar)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using a specified escape character and generate a text to perform a prefix search for the SQL LIKE operator.
      Specified by:
      prefix in interface ExpressionFunctions
      Parameters:
      text - the prefixed text
      escapeChar - the escape character
      Returns:
      the text for a prefix search
    • suffix

      public String suffix(CharSequence text)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using the default escape character '$' and generate a text to perform a suffix search for the SQL LIKE operator.

      For example, a%b_ is converted to the a %a$%b$_.

      Specified by:
      suffix in interface ExpressionFunctions
      Parameters:
      text - the suffix text
      Returns:
      the text for a suffix search
    • suffix

      public String suffix(CharSequence text, char escapeChar)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using a specified escape character and generate a text to perform a suffix search for the SQL LIKE operator.
      Specified by:
      suffix in interface ExpressionFunctions
      Parameters:
      text - the suffix text
      escapeChar - the escape character
      Returns:
      the text for a suffix search
    • infix

      public String infix(CharSequence text)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using the default escape character '$' and generate a text to perform a infix search for the SQL LIKE operator.

      For example, a%b_ is converted to the a %a$%b$_%.

      Specified by:
      infix in interface ExpressionFunctions
      Parameters:
      text - the infix text
      Returns:
      the text for a infix search
    • infix

      public String infix(CharSequence text, char escapeChar)
      Description copied from interface: ExpressionFunctions
      Escapes the SQL LIKE wild card characters in a target string by using a specified escape character and generate a text to perform a infix search for the SQL LIKE operator.
      Specified by:
      infix in interface ExpressionFunctions
      Parameters:
      text - the infix text
      escapeChar - the escape character
      Returns:
      the text for a infix search
    • escapeWildcard

      protected String escapeWildcard(CharSequence input, char escapeChar)
      Escapes wild card characters.
      Parameters:
      input - the target string for escaping
      escapeChar - the escape character
      Returns:
      the escaped string
    • escapeWildcard

      protected String escapeWildcard(Pattern pattern, CharSequence input, String replacement)
      Escapes wild card characters with the regular expression.
      Parameters:
      pattern - the regular expression pattern
      input - the target string for escaping
      replacement - the replacement string
      Returns:
      the escaped string
    • roundDownTimePart

      public Date roundDownTimePart(Date date)
      Description copied from interface: ExpressionFunctions
      Round down a time part of Date.
      Specified by:
      roundDownTimePart in interface ExpressionFunctions
      Parameters:
      date - the target date
      Returns:
      the date whose time part is rounded down
    • roundDownTimePart

      public Date roundDownTimePart(Date date)
      Description copied from interface: ExpressionFunctions
      Round down a time part of Date.
      Specified by:
      roundDownTimePart in interface ExpressionFunctions
      Parameters:
      date - the target date
      Returns:
      the date whose time part is rounded down
    • roundDownTimePart

      public Timestamp roundDownTimePart(Timestamp timestamp)
      Description copied from interface: ExpressionFunctions
      Round down a time part of Timestamp.
      Specified by:
      roundDownTimePart in interface ExpressionFunctions
      Parameters:
      timestamp - the target timestamp
      Returns:
      the timestamp whose time part is rounded down
    • roundDownTimePart

      public LocalDateTime roundDownTimePart(LocalDateTime localDateTime)
      Description copied from interface: ExpressionFunctions
      Round down a time part of LocalDateTime.
      Specified by:
      roundDownTimePart in interface ExpressionFunctions
      Parameters:
      localDateTime - the target localDateTime
      Returns:
      the localDateTime whose time part is rounded down
    • makeRoundedDownCalendar

      protected Calendar makeRoundedDownCalendar(Date date)
    • roundUpTimePart

      public Date roundUpTimePart(Date date)
      Description copied from interface: ExpressionFunctions
      Round up a time part of Date.
      Specified by:
      roundUpTimePart in interface ExpressionFunctions
      Parameters:
      date - the target date
      Returns:
      the date whose time part is rounded up
    • roundUpTimePart

      public Date roundUpTimePart(Date date)
      Description copied from interface: ExpressionFunctions
      Round up a time part of Date.
      Specified by:
      roundUpTimePart in interface ExpressionFunctions
      Parameters:
      date - the target date
      Returns:
      the date whose time part is rounded up
    • roundUpTimePart

      public Timestamp roundUpTimePart(Timestamp timestamp)
      Description copied from interface: ExpressionFunctions
      Round up a time part of Timestamp.
      Specified by:
      roundUpTimePart in interface ExpressionFunctions
      Parameters:
      timestamp - the target timestamp
      Returns:
      the timestamp whose time part is rounded up
    • roundUpTimePart

      public LocalDate roundUpTimePart(LocalDate localDate)
      Description copied from interface: ExpressionFunctions
      Return the next day.
      Specified by:
      roundUpTimePart in interface ExpressionFunctions
      Parameters:
      localDate - the target localDate
      Returns:
      the next day
    • roundUpTimePart

      public LocalDateTime roundUpTimePart(LocalDateTime localDateTime)
      Description copied from interface: ExpressionFunctions
      Round up a time part of LocalDateTime.
      Specified by:
      roundUpTimePart in interface ExpressionFunctions
      Parameters:
      localDateTime - the target localDateTime
      Returns:
      the localDateTime whose time part is rounded up
    • makeRoundedUpCalendar

      protected Calendar makeRoundedUpCalendar(Date date)
    • createWildcardReplacementPattern

      protected Pattern createWildcardReplacementPattern(char escapeChar, char[] wildcards)
      Creates the regular expression pattern that is represents the wild card characters .
      Parameters:
      escapeChar - the escape character
      wildcards - the wild card character
      Returns:
      the pattern
    • createWildcardReplacement

      protected String createWildcardReplacement(char escapeChar)
      Create the replacement string that replaces wild card characters.
      Parameters:
      escapeChar - the escape character
      Returns:
      the replacement string
    • isEmpty

      public boolean isEmpty(CharSequence charSequence)
      Description copied from interface: ExpressionFunctions
      Whether a text is empty.
      Specified by:
      isEmpty in interface ExpressionFunctions
      Parameters:
      charSequence - the target text
      Returns:
      true if the text is null or its length is 0, else false
    • isNotEmpty

      public boolean isNotEmpty(CharSequence charSequence)
      Description copied from interface: ExpressionFunctions
      Whether a text is not empty.
      Specified by:
      isNotEmpty in interface ExpressionFunctions
      Parameters:
      charSequence - the target text
      Returns:
      false if the text is null or its length is 0, else true
    • isBlank

      public boolean isBlank(CharSequence charSequence)
      Description copied from interface: ExpressionFunctions
      Whether a text is blank.
      Specified by:
      isBlank in interface ExpressionFunctions
      Parameters:
      charSequence - the target text
      Returns:
      true if the text is null, its length is 0 or the text contains only blank characters, else false.
    • isNotBlank

      public boolean isNotBlank(CharSequence charSequence)
      Description copied from interface: ExpressionFunctions
      Whether a text is not blank.
      Specified by:
      isNotBlank in interface ExpressionFunctions
      Parameters:
      charSequence - the target text
      Returns:
      false if the text is null, its length is 0 or the text contains only blank characters, else true.