1 22 23 package org.xquark.extractor.sql; 24 25 26 public class SqlSortSpecification extends SqlExpression 27 { 28 29 private static final String RCSRevision = "$Revision: 1.4 $"; 30 private static final String RCSName = "$Name: $"; 31 32 protected static final String SORT_DIRECTIONS[] = {"ASC","DESC"}; 33 private int _sortDirection; 34 private SqlExpression _sortExpression; 35 36 41 public SqlSortSpecification(SqlExpression sortExpression, int sortDirection) 42 { 43 setSortExpression ( sortExpression ); 44 setSortDirection ( sortDirection ) ; 45 } 46 47 50 public SqlSortSpecification() 51 { 52 } 53 54 59 public SqlExpression getSortExpression() 60 { 61 return _sortExpression; 62 } 63 64 69 public void setSortExpression(SqlExpression aSortExpression) 70 { 71 _sortExpression = aSortExpression; 72 } 73 74 75 76 81 public int getSortDirection() 82 { 83 return _sortDirection; 84 } 85 86 91 public void setSortDirection(int aSortDirection) 92 { 93 _sortDirection = aSortDirection; 94 } 95 96 100 public String toSql(Context context) 101 { 102 104 StringBuffer retVal = new StringBuffer (); 105 retVal.append("("); 106 retVal.append(_sortExpression.toSql(context)); 107 retVal.append(") ") ; 108 retVal.append(SORT_DIRECTIONS [_sortDirection]); 109 110 return retVal.toString(); 112 } 113 } 114 | Popular Tags |