- Type Parameters:
T- entity type.
- All Superinterfaces:
ComparableExpression<T,,String> Expression<T,String>
- All Known Subinterfaces:
StringLiteral,TextAttribute<T>,TextFunctionExpression<T>,TextPath<T,U>
- All Known Implementing Classes:
TextAttributeRecord
An expression that evaluates to a String
value.
The entity and static metamodel for the code
examples within this class are shown in the Attribute Javadoc.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptiondefault TextExpression<T> append(TextExpression<? super T> suffixExpression) Represents the function to obtain theStringvalue that is formed by appending the suffix to which the specified expression evaluates onto the end of the value to which the current expression evaluates.default TextExpression<T> Represents the function to obtain theStringvalue that is formed by appending the specified suffix onto the end of the value to which the current expression evaluates.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that contains the specified substring.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that ends with the specified suffix.default TextExpression<T> left(int length) Represents the function to obtain the specified number of characters at the beginning of the textual value to which the current expression evaluates.default NumericExpression<T, Integer> length()Represents the function to obtain the length of the textual value to which the current expression evaluates.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is like the specified pattern.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is like the specified pattern.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is like the specified pattern.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is like the specified pattern.default TextExpression<T> lower()Represents the function to obtain the lower case form of the value to which the current expression evaluates.default Restriction<T> notContains(String substring) Obtains aRestrictionthat requires that this expression evaluate to a value that does not contain the specified substring.default Restriction<T> notEndsWith(String suffix) Obtains aRestrictionthat requires that this expression evaluate to a value that does not end with the specified suffix.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is not like the specified pattern.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is not like the specified pattern.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value that is not like the specified pattern.default Restriction<T> notStartsWith(String prefix) Obtains aRestrictionthat requires that this expression evaluate to a value that does not begin with the specified prefix.default TextExpression<T> prepend(TextExpression<? super T> prefixExpression) Represents the function to obtain theStringvalue that is formed by prepending the prefix to which the specified expression evaluates onto the beginning of the value to which the current expression evaluates.default TextExpression<T> Represents the function to obtain theStringvalue that is formed by prepending the specified prefix onto the beginning of the value to which the current expression evaluates.default TextExpression<T> right(int length) Represents the function to obtain the specified number of characters at the end of the textual value to which the current expression evaluates.default Restriction<T> startsWith(String prefix) Obtains aRestrictionthat requires that this expression evaluate to a value that begins with the specified prefix.type()ReturnsString.classas the type of the textual expression.default TextExpression<T> upper()Represents the function to obtain the upper case form of the value to which the current expression evaluates.Methods inherited from interface jakarta.data.expression.ComparableExpression
between, between, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, lessThan, lessThan, lessThanEqual, lessThanEqual, notBetween, notBetweenMethods inherited from interface jakarta.data.expression.Expression
equalTo, equalTo, in, in, in, isNull, notEqualTo, notEqualTo, notIn, notIn, notIn, notNull, satisfies
-
Method Details
-
type
ReturnsString.classas the type of the textual expression.- Specified by:
typein interfaceExpression<T,String> - Returns:
String.class.
-
prepend
Represents the function to obtain the
Stringvalue that is formed by prepending the specified prefix onto the beginning of the value to which the current expression evaluates.Example:
found = cars.search(make, _Car.model.prepend("Model ").equalTo(model));- Returns:
- an expression for the function that computes the concatenated value.
- Throws:
NullPointerException- if the prefix isnull.
-
append
Represents the function to obtain the
Stringvalue that is formed by appending the specified suffix onto the end of the value to which the current expression evaluates.Example:
found = cars.search(make, _Car.model.append(" Hybrid").equalTo(hybridModel));- Returns:
- an expression for the function that computes the concatenated value.
- Throws:
NullPointerException- if the suffix isnull.
-
prepend
Represents the function to obtain the
Stringvalue that is formed by prepending the prefix to which the specified expression evaluates onto the beginning of the value to which the current expression evaluates.Example:
TODO
found = cars.search( make, _Car.model.prepend(_Car.year.append(" ")).equalTo(yearAndModel));- Returns:
- an expression for the function that computes the concatenated value.
- Throws:
NullPointerException- if the prefix expression isnull.
-
append
Represents the function to obtain the
Stringvalue that is formed by appending the suffix to which the specified expression evaluates onto the end of the value to which the current expression evaluates.Example:
found = cars.search(_Car.make.append(' ').append(_Car.model).equalTo(makeAndModel));- Returns:
- an expression for the function that computes the concatenated value.
- Throws:
NullPointerException- if the suffix expression isnull.
-
upper
Represents the function to obtain the upper case form of the value to which the current expression evaluates.
Example:
found = cars.search(_Car.make.upper().startsWith("CHEV"));- Returns:
- an expression for the function that computes the upper case form of the value.
-
lower
Represents the function to obtain the lower case form of the value to which the current expression evaluates.
Example:
found = cars.search(make, _Car.model.lower().startsWith("f-"));- Returns:
- an expression for the function that computes the lower case form of the value.
-
left
Represents the function to obtain the specified number of characters at the beginning of the textual value to which the current expression evaluates.
Example:
startsWithCX = cars.search(make, _Car.model.left(2).equalTo("CX"));- Returns:
- an expression for the function that obtains the leftmost characters.
-
right
Represents the function to obtain the specified number of characters at the end of the textual value to which the current expression evaluates.
Example:
endsWithHybrid = cars.search(make, _Car.model.right(6).equalTo("Hybrid"));- Returns:
- an expression for the function that obtains the rightmost characters.
-
length
Represents the function to obtain the length of the textual value to which the current expression evaluates.
Example:
withModelNamesUpTo10Chars = cars.search(make, _Car.model.length().lessThanEqual(10));- Returns:
- an expression for the function that obtains the length of the textual value.
-
like
Obtains a
Restrictionthat requires that this expression evaluate to a value that is like the specified pattern.Example:
found = cars.search(make, _Car.model.like(Like.pattern("% Hybrid")));- Parameters:
pattern- pattern against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the pattern value isnull.
-
like
Obtains a
Restrictionthat requires that this expression evaluate to a value that is like the specified pattern.Example:
found = cars.search(_Car.make.like("Chev%"));- Parameters:
pattern- pattern against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the pattern isnull.
-
like
Obtains a
Restrictionthat requires that this expression evaluate to a value that is like the specified pattern.Example:
found = cars.search(make, _Car.model.like("F-_50%", '_', '%'));- Parameters:
pattern- pattern against which to compare. Must not benull.charWildcard- character that represents a position in the pattern where any 1 character is considered to match.stringWildcard- character that represents a position in the pattern where any number of characters (including 0) are considered to match.- Returns:
- the restriction.
- Throws:
NullPointerException- if the pattern value isnull.
-
like
Obtains a
Restrictionthat requires that this expression evaluate to a value that is like the specified pattern.Example:
found = cars.search(make, _Car.model.like("_R-V%", '_', '%', '^'));- Parameters:
pattern- pattern against which to compare. Must not benull.charWildcard- character that represents a position in the pattern where any 1 character is considered to match.stringWildcard- character that represents a position in the pattern where any number of characters (including 0) are considered to match.escape- character to use as an escape character within the pattern, indicating that the subsequent wildcard or escape character must be interpreted as its literal value rather than as a wildcard or escape.- Returns:
- the restriction.
- Throws:
NullPointerException- if the pattern value isnull.
-
notLike
Obtains a
Restrictionthat requires that this expression evaluate to a value that is not like the specified pattern.Example:
found = cars.search(make, _Car.model.notLike("% EV"));- Parameters:
pattern- pattern against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the pattern value isnull.
-
notLike
Obtains a
Restrictionthat requires that this expression evaluate to a value that is not like the specified pattern.Example:
found = cars.search(make, _Car.model.notLike("CX-_0 *", '_', '*'));- Parameters:
pattern- pattern against which to compare. Must not benull.charWildcard- character that represents a position in the pattern where any 1 character is considered to match.stringWildcard- character that represents a position in the pattern where any number of characters (including 0) are considered to match.- Throws:
NullPointerException- if the pattern value isnull.
-
notLike
Obtains a
Restrictionthat requires that this expression evaluate to a value that is not like the specified pattern.Example:
found = cars.search(make, _Car.model.notLike("* EV*", '_', '*', '^'));- Parameters:
pattern- pattern against which to compare. Must not benull.charWildcard- character that represents a position in the pattern where any 1 character is considered to match.stringWildcard- character that represents a position in the pattern where any number of characters (including 0) are considered to match.escape- character to use as an escape character within the pattern, indicating that the subsequent wildcard or escape character must be interpreted as its literal value rather than as a wildcard or escape.- Returns:
- the restriction.
- Throws:
NullPointerException- if the pattern value isnull.
-
contains
Obtains a
Restrictionthat requires that this expression evaluate to a value that contains the specified substring.Example:
found = cars.search(make, _Car.model.contains("Hybrid"));- Parameters:
substring- substring against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the substring value isnull.
-
notContains
Obtains a
Restrictionthat requires that this expression evaluate to a value that does not contain the specified substring.Example:
found = cars.search(make, _Car.model.notContains(" EV"));- Parameters:
substring- substring against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the substring value isnull.
-
startsWith
Obtains a
Restrictionthat requires that this expression evaluate to a value that begins with the specified prefix.Example:
found = cars.search(_Car.make.startsWith("Chev"));- Parameters:
prefix- prefix against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the prefix value isnull.
-
notStartsWith
Obtains a
Restrictionthat requires that this expression evaluate to a value that does not begin with the specified prefix.Example:
found = cars.search(make, _Car.model.notStartsWith("CR-"));- Parameters:
prefix- prefix against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the prefix value isnull.
-
endsWith
Obtains a
Restrictionthat requires that this expression evaluate to a value that ends with the specified suffix.Example:
found = cars.search(make, _Car.model.endsWith(" EV"));- Parameters:
suffix- suffix against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the suffix value isnull.
-
notEndsWith
Obtains a
Restrictionthat requires that this expression evaluate to a value that does not end with the specified suffix.Example:
found = cars.search(make, _Car.model.notEndsWith(" Hybrid"));- Parameters:
suffix- suffix against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the suffix value isnull.
-