15
15
*/
16
16
package org .mybatis .dynamic .sql ;
17
17
18
- import org .mybatis .dynamic .sql .exception .DynamicSqlException ;
19
18
import org .mybatis .dynamic .sql .render .RenderingContext ;
20
19
import org .mybatis .dynamic .sql .util .FragmentAndParameters ;
21
- import org .mybatis .dynamic .sql .util .Messages ;
22
20
23
21
/**
24
22
* Defines attributes of columns that are necessary for rendering an order by expression.
@@ -35,37 +33,12 @@ public interface SortSpecification {
35
33
SortSpecification descending ();
36
34
37
35
/**
38
- * Return the phrase that should be written into a rendered order by clause. This should
39
- * NOT include the "DESC" word for descending sort specifications .
36
+ * Return a fragment rendered for use in an ORDER BY clause. The fragment should include "DESC" if a
37
+ * descending order is desired .
40
38
*
41
- * @return the order by phrase
42
- * @deprecated Please replace this method by overriding the more general "renderForOrderBy" method. Target for
43
- * removal in release 2.1
39
+ * @param renderingContext the current rendering context
40
+ * @return a rendered fragment and parameters if applicable
41
+ * @since 2.0.0
44
42
*/
45
- @ Deprecated (since = "2.0" , forRemoval = true )
46
- default String orderByName () {
47
- throw new DynamicSqlException (Messages .getString ("ERROR.44" )); //$NON-NLS-1$
48
- }
49
-
50
- /**
51
- * Return true if the sort order is descending.
52
- *
53
- * @return true if the SortSpecification should render as descending
54
- * @deprecated Please replace this method by overriding the more general "renderForOrderBy" method. Target for
55
- * removal in release 2.1
56
- */
57
- @ Deprecated (since = "2.0" , forRemoval = true )
58
- default boolean isDescending () {
59
- throw new DynamicSqlException (Messages .getString ("ERROR.44" )); //$NON-NLS-1$
60
- }
61
-
62
- // the default implementation ensures compatibility with prior releases. When the
63
- // deprecated methods are removed, this function can become purely abstract.
64
- default FragmentAndParameters renderForOrderBy (RenderingContext renderingContext ) {
65
- String phrase = orderByName ();
66
- if (isDescending ()) {
67
- phrase = phrase + " DESC" ; //$NON-NLS-1$
68
- }
69
- return FragmentAndParameters .fromFragment (phrase );
70
- }
43
+ FragmentAndParameters renderForOrderBy (RenderingContext renderingContext );
71
44
}
0 commit comments