Module jakarta.data

Interface StringLiteral

All Superinterfaces:
ComparableExpression<Object,String>, ComparableLiteral<String>, Expression<Object,String>, Literal<String>, TextExpression<Object>

public interface StringLiteral extends ComparableLiteral<String>, TextExpression<Object>

A literal for a String value.

Since:
1.1
  • Method Details

    • of

      static StringLiteral of(String value)

      Creates a StringLiteral that represents the given value.

      Parameters:
      value - a String value. Must never be null.
      Returns:
      a StringLiteral representing the value.
      Throws:
      NullPointerException - if the value is null.
    • toString

      String toString()

      Returns a String representing the value. The String is the value enclosed in single quotes and with each single quote character in the value escaped with a single quote.

      For example, the output of StringLiteral.of("Jakarta Data's second release").toString() is

       'Jakarta Data''s second release'
       
      Specified by:
      toString in interface ComparableLiteral<String>
      Specified by:
      toString in interface Literal<String>
      Overrides:
      toString in class Object
      Returns:
      the String value escaped and enclosed in single quotes.