- Type Parameters:
V- entity attribute type.
- All Superinterfaces:
Expression<Object,V>
- All Known Subinterfaces:
BooleanLiteral,ComparableLiteral<V>,NumericLiteral<N>,StringLiteral,TemporalLiteral<V>
Literal represents an immutable value within an
Expression. Literals are created implicitly when obtaining
expressions that involve literal values.
The entity and static metamodel for the code
examples within this class are shown in the Attribute Javadoc.
- Since:
- 1.1
-
Method Summary
Methods inherited from interface jakarta.data.expression.Expression
equalTo, equalTo, in, in, in, isNull, notEqualTo, notEqualTo, notIn, notIn, notIn, notNull, satisfies, type
-
Method Details
-
value
V value()Returns the value represented by this
Literal. The value will never benull.- Returns:
- the value.
-
of
Creates a
Literalor subtype ofLiteralthat represents the given value.The most specific subtype of
Literal, such asNumericLiteral,StringLiteral,TemporalLiteral, orComparableLiteral, should be used instead wherever possible.- Type Parameters:
V- entity attribute type.- Parameters:
value- an immutable value or a mutable value that must never be modified after it is supplied to this method. Must never benull.- Returns:
- a
Literalrepresenting the value. - Throws:
NullPointerException- if the value isnull.
-
toString
String toString()Returns a
Stringrepresenting the literal value.Subtypes of
Literaloverride this method to define more specific formats that more closely align with query language.This method outputs a
Stringthat begins with an opening curly brace and ends with a closing curly brace. Between the braces are 3 terms delimited by a space character. The first term isLiteral. The second term is the fully qualified class name of the value's type. The third term is thetoString()output of the value, enclosed in single quotes.For example, the output of
Literal.of(ZoneId.of("America/Chicago")).toString()is{Literal java.time.ZoneId 'America/Chicago'}
-