1515 */
1616package org .mybatis .dynamic .sql ;
1717
18- import org .mybatis .dynamic .sql .exception .DynamicSqlException ;
1918import org .mybatis .dynamic .sql .render .RenderingContext ;
2019import org .mybatis .dynamic .sql .util .FragmentAndParameters ;
21- import org .mybatis .dynamic .sql .util .Messages ;
2220
2321/**
2422 * Defines attributes of columns that are necessary for rendering an order by expression.
@@ -35,37 +33,12 @@ public interface SortSpecification {
3533 SortSpecification descending ();
3634
3735 /**
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 .
4038 *
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
4442 */
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 );
7144}
0 commit comments