@@ -30,7 +30,7 @@ public class SqlColumn<T> implements BindableColumn<T>, SortSpecification {
30
30
protected final String name ;
31
31
protected final SqlTable table ;
32
32
protected final JDBCType jdbcType ;
33
- protected final boolean isDescending ;
33
+ protected final String descendingPhrase ;
34
34
protected final String alias ;
35
35
protected final String typeHandler ;
36
36
protected final RenderingStrategy renderingStrategy ;
@@ -42,7 +42,7 @@ private SqlColumn(Builder<T> builder) {
42
42
name = Objects .requireNonNull (builder .name );
43
43
table = Objects .requireNonNull (builder .table );
44
44
jdbcType = builder .jdbcType ;
45
- isDescending = builder .isDescending ;
45
+ descendingPhrase = builder .descendingPhrase ;
46
46
alias = builder .alias ;
47
47
typeHandler = builder .typeHandler ;
48
48
renderingStrategy = builder .renderingStrategy ;
@@ -87,7 +87,7 @@ public Object convertParameterType(T value) {
87
87
@ Override
88
88
public SortSpecification descending () {
89
89
Builder <T > b = copy ();
90
- return b .withDescending ( true ).build ();
90
+ return b .withDescendingPhrase ( " DESC" ).build (); //$NON-NLS-1$
91
91
}
92
92
93
93
@ Override
@@ -126,13 +126,8 @@ public SqlColumn<T> asCamelCase() {
126
126
}
127
127
128
128
@ Override
129
- public boolean isDescending () {
130
- return isDescending ;
131
- }
132
-
133
- @ Override
134
- public String orderByName () {
135
- return alias ().orElse (name );
129
+ public FragmentAndParameters renderForOrderBy (RenderingContext renderingContext ) {
130
+ return FragmentAndParameters .fromFragment (alias ().orElse (name ) + descendingPhrase );
136
131
}
137
132
138
133
@ Override
@@ -188,7 +183,7 @@ private <S> Builder<S> copy() {
188
183
.withName (this .name )
189
184
.withTable (this .table )
190
185
.withJdbcType (this .jdbcType )
191
- .withDescending (this .isDescending )
186
+ .withDescendingPhrase (this .descendingPhrase )
192
187
.withAlias (this .alias )
193
188
.withTypeHandler (this .typeHandler )
194
189
.withRenderingStrategy (this .renderingStrategy )
@@ -214,7 +209,7 @@ public static class Builder<T> {
214
209
protected String name ;
215
210
protected SqlTable table ;
216
211
protected JDBCType jdbcType ;
217
- protected boolean isDescending = false ;
212
+ protected String descendingPhrase = "" ; //$NON-NLS-1$
218
213
protected String alias ;
219
214
protected String typeHandler ;
220
215
protected RenderingStrategy renderingStrategy ;
@@ -237,8 +232,8 @@ public Builder<T> withJdbcType(JDBCType jdbcType) {
237
232
return this ;
238
233
}
239
234
240
- public Builder <T > withDescending ( boolean isDescending ) {
241
- this .isDescending = isDescending ;
235
+ public Builder <T > withDescendingPhrase ( String descendingPhrase ) {
236
+ this .descendingPhrase = descendingPhrase ;
242
237
return this ;
243
238
}
244
239
0 commit comments