Override in all subtypes

This commit is contained in:
Jan-Willem Gmelig Meyling 2021-01-26 12:18:01 +01:00
parent 3ed6c822bb
commit dfd0efdeeb
9 changed files with 165 additions and 4 deletions

View File

@ -154,4 +154,27 @@ public abstract class BooleanExpression extends LiteralExpression<Boolean> imple
return eqFalse;
}
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public BooleanExpression nullif(Expression<Boolean> other) {
return Expressions.booleanOperation(Ops.NULLIF, mixin, other);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public BooleanExpression nullif(Boolean other) {
return nullif(ConstantImpl.create(other));
}
}

View File

@ -387,4 +387,27 @@ public abstract class ComparableExpression<T extends Comparable> extends Compara
return Expressions.comparableOperation(getType(), Ops.AggOps.MAX_AGG, mixin);
}
/**
* 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, mixin, 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));
}
}

View File

@ -88,8 +88,8 @@ public abstract class ComparableExpressionBase<T extends Comparable> extends Sim
* @return nullif(this, other)
*/
@Override
public ComparableExpression<T> nullif(Expression<T> other) {
return Expressions.comparableOperation(this.getType(), Ops.NULLIF, this, other);
public ComparableExpressionBase<T> nullif(Expression<T> other) {
return Expressions.comparableOperation(this.getType(), Ops.NULLIF, mixin, other);
}
/**
@ -99,7 +99,7 @@ public abstract class ComparableExpressionBase<T extends Comparable> extends Sim
* @return nullif(this, other)
*/
@Override
public ComparableExpression<T> nullif(T other) {
public ComparableExpressionBase<T> nullif(T other) {
return nullif(ConstantImpl.create(other));
}

View File

@ -15,6 +15,7 @@ package com.querydsl.core.types.dsl;
import java.util.Date;
import com.querydsl.core.types.ConstantImpl;
import org.jetbrains.annotations.Nullable;
import com.querydsl.core.types.Expression;
@ -204,4 +205,27 @@ public abstract class DateExpression<T extends Comparable> extends TemporalExpre
}
return yearWeek;
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public DateExpression<T> nullif(Expression<T> other) {
return Expressions.dateOperation(getType(), Ops.NULLIF, mixin, other);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public DateExpression<T> nullif(T other) {
return nullif(ConstantImpl.create(other));
}
}

View File

@ -15,6 +15,7 @@ package com.querydsl.core.types.dsl;
import java.util.Date;
import com.querydsl.core.types.ConstantImpl;
import org.jetbrains.annotations.Nullable;
import com.querydsl.core.types.Expression;
@ -275,4 +276,26 @@ public abstract class DateTimeExpression<T extends Comparable> extends TemporalE
return yearWeek;
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public DateTimeExpression<T> nullif(Expression<T> other) {
return Expressions.dateTimeOperation(getType(), Ops.NULLIF, mixin, other);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public DateTimeExpression<T> nullif(T other) {
return nullif(ConstantImpl.create(other));
}
}

View File

@ -13,6 +13,7 @@
*/
package com.querydsl.core.types.dsl;
import com.querydsl.core.types.ConstantImpl;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.ExpressionUtils;
import com.querydsl.core.types.Ops;
@ -57,4 +58,26 @@ public abstract class EnumExpression<T extends Enum<T>> extends LiteralExpressio
return ordinal;
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public EnumExpression<T> nullif(Expression<T> other) {
return Expressions.enumOperation(getType(), Ops.NULLIF, mixin, other);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public EnumExpression<T> nullif(T other) {
return nullif(ConstantImpl.create(other));
}
}

View File

@ -782,4 +782,26 @@ public abstract class NumberExpression<T extends Number & Comparable<?>> extends
return list;
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public NumberExpression<T> nullif(Expression<T> other) {
return Expressions.numberOperation(getType(), Ops.NULLIF, mixin, other);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public NumberExpression<T> nullif(T other) {
return nullif(ConstantImpl.create(other));
}
}

View File

@ -849,7 +849,7 @@ public abstract class StringExpression extends LiteralExpression<String> {
*/
@Override
public StringExpression nullif(Expression<String> other) {
return Expressions.stringOperation(Ops.NULLIF, this, other);
return Expressions.stringOperation(Ops.NULLIF, mixin, other);
}
/**

View File

@ -15,6 +15,7 @@ package com.querydsl.core.types.dsl;
import java.sql.Time;
import com.querydsl.core.types.ConstantImpl;
import org.jetbrains.annotations.Nullable;
import com.querydsl.core.types.Expression;
@ -121,4 +122,26 @@ public abstract class TimeExpression<T extends Comparable> extends TemporalExpre
return Expressions.timeOperation(cl, Ops.DateTimeOps.CURRENT_TIME);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public TimeExpression<T> nullif(Expression<T> other) {
return Expressions.timeOperation(getType(), Ops.NULLIF, mixin, other);
}
/**
* Create a {@code nullif(this, other)} expression
*
* @param other
* @return nullif(this, other)
*/
@Override
public TimeExpression<T> nullif(T other) {
return nullif(ConstantImpl.create(other));
}
}