mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
Type nullif in ComparableExpression and StringExpression
This commit is contained in:
parent
d651911bd5
commit
3ed6c822bb
@ -13,6 +13,7 @@
|
||||
*/
|
||||
package com.querydsl.core.types.dsl;
|
||||
|
||||
import com.querydsl.core.types.ConstantImpl;
|
||||
import com.querydsl.core.types.Ops;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -80,6 +81,28 @@ public abstract class ComparableExpressionBase<T extends Comparable> extends Sim
|
||||
return coalesce;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code nullif(this, other)} expression
|
||||
*
|
||||
* @param other
|
||||
* @return nullif(this, other)
|
||||
*/
|
||||
@Override
|
||||
public ComparableExpression<T> nullif(Expression<T> other) {
|
||||
return Expressions.comparableOperation(this.getType(), Ops.NULLIF, this, other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code nullif(this, other)} expression
|
||||
*
|
||||
* @param other
|
||||
* @return nullif(this, other)
|
||||
*/
|
||||
@Override
|
||||
public ComparableExpression<T> nullif(T other) {
|
||||
return nullif(ConstantImpl.create(other));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an OrderSpecifier for descending order of this expression
|
||||
*
|
||||
|
||||
@ -840,4 +840,27 @@ public abstract class StringExpression extends LiteralExpression<String> {
|
||||
return upper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@code nullif(this, other)} expression
|
||||
*
|
||||
* @param other
|
||||
* @return nullif(this, other)
|
||||
*/
|
||||
@Override
|
||||
public StringExpression nullif(Expression<String> other) {
|
||||
return Expressions.stringOperation(Ops.NULLIF, this, other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code nullif(this, other)} expression
|
||||
*
|
||||
* @param other
|
||||
* @return nullif(this, other)
|
||||
*/
|
||||
@Override
|
||||
public StringExpression nullif(String other) {
|
||||
return nullif(ConstantImpl.create(other));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user