Skip to content

Commit a40ace0

Browse files
committed
Better deprecation messages
1 parent 648baae commit a40ace0

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import org.mybatis.dynamic.sql.ExistsPredicate
2323
import org.mybatis.dynamic.sql.SqlCriterion
2424
import org.mybatis.dynamic.sql.VisitableCondition
2525

26-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
26+
@Deprecated("Deprecated in favor of the new where clause DSL.")
2727
typealias CriteriaReceiver = CriteriaCollector.() -> Unit
2828

29-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
29+
@Deprecated("Deprecated in favor of the new where clause DSL.")
3030
@MyBatisDslMarker
3131
class CriteriaCollector {
3232
val criteria = mutableListOf<AndOrCriteriaGroup>()

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,82 +58,91 @@ abstract class KotlinBaseBuilder<D : AbstractWhereSupport<*>, B : KotlinBaseBuil
5858
whereApplier.invoke(this)
5959
}
6060

61-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
61+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the column and condition " +
62+
"into a lambda and rewriting the condition to use an infix function.")
6263
fun <T> where(column: BindableColumn<T>, condition: VisitableCondition<T>): B =
6364
applyToWhere {
6465
where(column, condition)
6566
}
6667

67-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
68+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the column and condition " +
69+
"inside the lambda and rewriting the condition to use an infix function.")
6870
fun <T> where(column: BindableColumn<T>, condition: VisitableCondition<T>, subCriteria: CriteriaReceiver): B =
6971
applyToWhere(subCriteria) { sc ->
7072
where(column, condition, sc)
7173
}
7274

7375
@Deprecated(
74-
message = "Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.",
76+
message = "Deprecated in favor of the new where clause DSL.",
7577
replaceWith = ReplaceWith("where { existsPredicate }")
7678
)
7779
fun where(existsPredicate: ExistsPredicate): B =
7880
applyToWhere {
7981
where(existsPredicate)
8082
}
8183

82-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
84+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the exists expression " +
85+
"into the lambda.")
8386
fun where(existsPredicate: ExistsPredicate, subCriteria: CriteriaReceiver): B =
8487
applyToWhere(subCriteria) { sc ->
8588
where(existsPredicate, sc)
8689
}
8790

88-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
91+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the column and condition " +
92+
"into a lambda and rewriting the condition to use an infix function.")
8993
fun <T> and(column: BindableColumn<T>, condition: VisitableCondition<T>): B =
9094
applyToWhere {
9195
and(column, condition)
9296
}
9397

94-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
98+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the column and condition " +
99+
"inside the lambda and rewriting the condition to use an infix function.")
95100
fun <T> and(column: BindableColumn<T>, condition: VisitableCondition<T>, subCriteria: CriteriaReceiver): B =
96101
applyToWhere(subCriteria) { sc ->
97102
and(column, condition, sc)
98103
}
99104

100105
@Deprecated(
101-
message = "Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.",
106+
message = "Deprecated in favor of the new where clause DSL.",
102107
replaceWith = ReplaceWith("and { existsPredicate }")
103108
)
104109
fun and(existsPredicate: ExistsPredicate): B =
105110
applyToWhere {
106111
and(existsPredicate)
107112
}
108113

109-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
114+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the exists expression " +
115+
"into the lambda.")
110116
fun and(existsPredicate: ExistsPredicate, subCriteria: CriteriaReceiver): B =
111117
applyToWhere(subCriteria) { sc ->
112118
and(existsPredicate, sc)
113119
}
114120

115-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
121+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the column and condition " +
122+
"into a lambda and rewriting the condition to use an infix function.")
116123
fun <T> or(column: BindableColumn<T>, condition: VisitableCondition<T>): B =
117124
applyToWhere {
118125
or(column, condition)
119126
}
120127

121-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
128+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the column and condition " +
129+
"inside the lambda and rewriting the condition to use an infix function.")
122130
fun <T> or(column: BindableColumn<T>, condition: VisitableCondition<T>, subCriteria: CriteriaReceiver): B =
123131
applyToWhere(subCriteria) { sc ->
124132
or(column, condition, sc)
125133
}
126134

127135
@Deprecated(
128-
message = "Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.",
136+
message = "Deprecated in favor of the new where clause DSL.",
129137
replaceWith = ReplaceWith("or { existsPredicate }")
130138
)
131139
fun or(existsPredicate: ExistsPredicate): B =
132140
applyToWhere {
133141
or(existsPredicate)
134142
}
135143

136-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
144+
@Deprecated("Deprecated in favor of the new where clause DSL. Update by moving the exists expression " +
145+
"into the lambda.")
137146
fun or(existsPredicate: ExistsPredicate, subCriteria: CriteriaReceiver): B =
138147
applyToWhere(subCriteria) { sc ->
139148
or(existsPredicate, sc)

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/elements/SqlElements.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@ fun <T> isNull(): IsNull<T> = SqlBuilder.isNull()
151151

152152
fun <T> isNotNull(): IsNotNull<T> = SqlBuilder.isNotNull()
153153

154-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
154+
@Deprecated("Deprecated in favor of the new where clause DSL. " +
155+
"Rewrite to use the exists function inside a lambda.")
155156
fun exists(subQuery: KotlinSubQueryBuilder.() -> Unit): ExistsPredicate =
156157
SqlBuilder.exists(KotlinSubQueryBuilder().apply(subQuery))
157158

158-
@Deprecated("Deprecated in favor of the new where clause DSL. Please see the documentation for new usage.")
159+
@Deprecated("Deprecated in favor of the new where clause DSL. " +
160+
"Rewrite to use the exists function inside a \"not\" expression.")
159161
fun notExists(subQuery: KotlinSubQueryBuilder.() -> Unit): ExistsPredicate =
160162
SqlBuilder.notExists(KotlinSubQueryBuilder().apply(subQuery))
161163

0 commit comments

Comments
 (0)