Class Comparison
java.lang.Object
org.springframework.data.relational.core.sql.Comparison
- All Implemented Interfaces:
Condition
,Expression
,Segment
,Visitable
Comparing
Condition
comparing two Expression
s.
Results in a rendered condition: <left> <comparator> <right>
(e.g. col = 'predicate'
.
- Since:
- 1.1
- Author:
- Mark Paluch, Jens Schauder
-
Method Summary
Modifier and TypeMethodDescriptionstatic Comparison
Creates a newComparison
from simple StringP argumentsstatic Comparison
create
(Expression leftColumnOrExpression, String comparator, Expression rightColumnOrExpression) boolean
getLeft()
getRight()
int
hashCode()
Generate a hash code from thisSegment
.not()
toString()
Return a SQL string representation of thisSegment
.void
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Method Details
-
create
public static Comparison create(Expression leftColumnOrExpression, String comparator, Expression rightColumnOrExpression) - Parameters:
leftColumnOrExpression
- the leftExpression
.comparator
- the comparator.rightColumnOrExpression
- the rightExpression
.- Returns:
- the
Comparison
condition.
-
create
Creates a newComparison
from simple StringP arguments- Parameters:
unqualifiedColumnName
- gets turned in aExpressions.just(String)
and is expected to be an unqualified unique column name but also could be an verbatim expression. Must not be null.comparator
- must not be null.rightValue
- is considered aLiteral
. Must not be null.- Returns:
- a new Comparison of the first with the third argument using the second argument as comparison operator. Guaranteed to be not null.
- Since:
- 2.3
-
not
Description copied from interface:Condition
-
getLeft
- Returns:
- the left
Expression
.
-
getComparator
- Returns:
- the comparator.
-
getRight
- Returns:
- the right
Expression
.
-
toString
Description copied from interface:Segment
Return a SQL string representation of thisSegment
.The representation is intended for debugging purposes and an approximation to the generated SQL. While it might work in the context of a specific dialect, you should not assume that the
Segment.toString()
representation works across multiple databases. -
visit
Description copied from interface:Visitable
-
hashCode
public int hashCode()Description copied from interface:Segment
Generate a hash code from thisSegment
.Hashcode typically derives from the
Segment.toString()
representation so twoSegment
s yield the sameSegment.hashCode()
if theirSegment.toString()
representation matches. -
equals
Description copied from interface:Segment
Check whether thisSegment
is equal to anotherSegment
.Equality is typically given if the
Segment.toString()
representation matches.
-