Package groovy.sql

# Class SqlOrderByVisitor

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
groovy.sql.SqlOrderByVisitor

All Implemented Interfaces:
  `GroovyCodeVisitor`

public class SqlOrderByVisitor extends CodeVisitorSupport
AST visitor used by `DataSet` to derive an SQL `ORDER BY` clause from a simple sort closure.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SqlOrderByVisitor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getOrderBy()`
  Returns the SQL `ORDER BY` fragment built so far.
  `void`
  `visitPropertyExpression(PropertyExpression expression)`
  Appends the referenced property name as the next order-by term.
  `void`
  `visitReturnStatement(ReturnStatement statement)`
  Visits the closure return expression that defines the sort key.

  ### Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport

  `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor

  `visit, visit, visitEmptyExpression, visitListOfExpressions`

- ## Constructor Details

  - ### SqlOrderByVisitor

    public SqlOrderByVisitor()

- ## Method Details

  - ### getOrderBy

    public String getOrderBy()
    Returns the SQL `ORDER BY` fragment built so far.
    Returns:
      the derived order-by fragment

  - ### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)
    Visits the closure return expression that defines the sort key.
    Specified by:
      `visitReturnStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitReturnStatement` in class `CodeVisitorSupport`
    Parameters:
      `statement` - the return statement to visit

  - ### visitPropertyExpression

    public void visitPropertyExpression(PropertyExpression expression)
    Appends the referenced property name as the next order-by term.
    Specified by:
      `visitPropertyExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitPropertyExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the property expression to visit