Skip to content

Commit 3cd872b

Browse files
committed
Add deprecation notices
1 parent 093052f commit 3cd872b

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,32 @@ static <T> ColumnAndConditionCriterion<T> on(BindableColumn<T> joinColumn, Visit
435435
.build();
436436
}
437437

438+
/**
439+
* Starting in version 2.0.0, this function is a synonym for {@link SqlBuilder#isEqualTo(BasicColumn)}.
440+
*
441+
* @param column the column
442+
* @return an IsEqualToColumn condition
443+
* @param <T> the column type
444+
* @deprecated since 2.0.0. Please replace with isEqualTo(column)
445+
*/
446+
@Deprecated(since = "2.0.0", forRemoval = true)
447+
static <T> IsEqualToColumn<T> equalTo(BindableColumn<T> column) {
448+
return isEqualTo(column);
449+
}
450+
451+
/**
452+
* Starting in version 2.0.0, this function is a synonym for {@link SqlBuilder#isEqualTo(Object)}.
453+
*
454+
* @param value the value
455+
* @return an IsEqualTo condition
456+
* @param <T> the column type
457+
* @deprecated since 2.0.0. Please replace with isEqualTo(value)
458+
*/
459+
@Deprecated(since = "2.0.0", forRemoval = true)
460+
static <T> IsEqualTo<T> equalTo(T value) {
461+
return isEqualTo(value);
462+
}
463+
438464
// case expressions
439465
@SuppressWarnings("java:S100")
440466
static <T> SimpleCaseDSL<T> case_(BindableColumn<T> column) {
@@ -446,16 +472,6 @@ static SearchedCaseDSL case_() {
446472
return SearchedCaseDSL.searchedCase();
447473
}
448474

449-
// TODO - Deprecate?
450-
static <T> IsEqualToColumn<T> equalTo(BindableColumn<T> column) {
451-
return IsEqualToColumn.of(column);
452-
}
453-
454-
// TODO - Deprecate?
455-
static <T> IsEqualTo<T> equalTo(T value) {
456-
return IsEqualTo.of(value);
457-
}
458-
459475
// aggregate support
460476
static CountAll count() {
461477
return new CountAll();

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/JoinCollector.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ class JoinCollector {
3333
criteriaCollector.apply(receiver)
3434
}
3535

36-
// TODO - Deprecate?
36+
@Deprecated("Please replace with the \"on\" lambda expression", level = DeprecationLevel.WARNING)
3737
fun <T> on(leftColumn: BindableColumn<T>): RightColumnCollector<T> = RightColumnCollector {
3838
assertNull(criteriaCollector.initialCriterion, "ERROR.45") //$NON-NLS-1$
3939
criteriaCollector.apply { leftColumn.invoke(it) }
4040
}
4141

42-
// TODO - Deprecate?
42+
@Deprecated("Please move the \"and\" expression into an \"on\" lambda", level = DeprecationLevel.WARNING)
4343
fun <T> and(leftColumn: BindableColumn<T>): RightColumnCollector<T> = RightColumnCollector {
4444
criteriaCollector.and { leftColumn.invoke(it) }
4545
}
4646
}
4747

4848
class RightColumnCollector<T>(private val joinConditionConsumer: (VisitableCondition<T>) -> Unit) {
49-
infix fun equalTo(rightColumn: BindableColumn<T>) = joinConditionConsumer.invoke(SqlBuilder.equalTo(rightColumn))
49+
infix fun equalTo(rightColumn: BindableColumn<T>) = joinConditionConsumer.invoke(SqlBuilder.isEqualTo(rightColumn))
5050

51-
infix fun equalTo(value: T) = joinConditionConsumer.invoke(SqlBuilder.equalTo(value))
51+
infix fun equalTo(value: T) = joinConditionConsumer.invoke(SqlBuilder.isEqualTo(value))
5252
}

0 commit comments

Comments
 (0)