java.lang.Object
org.springframework.data.relational.core.sql.Comparison
- All Implemented Interfaces:
Condition,Expression,Segment,Visitable
Comparing
Condition comparing two Expressions.
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 ComparisonCreates a newComparisonfrom simple StringP argumentsstatic Comparisoncreate(Expression leftColumnOrExpression, String comparator, Expression rightColumnOrExpression) booleangetLeft()getRight()inthashCode()Generate a hash code from thisSegment.not()toString()Return a SQL string representation of thisSegment.voidMethods 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
Comparisoncondition.
-
create
Creates a newComparisonfrom 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:SegmentReturn 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:SegmentGenerate a hash code from thisSegment.Hashcode typically derives from the
Segment.toString()representation so twoSegments yield the sameSegment.hashCode()if theirSegment.toString()representation matches. -
equals
Description copied from interface:SegmentCheck whether thisSegmentis equal to anotherSegment.Equality is typically given if the
Segment.toString()representation matches.
-