001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Bogdan Stefanescu 011 * Florent Guillaume 012 */ 013 014package org.nuxeo.ecm.core.query.sql.model; 015 016/** 017 * @author Bogdan Stefanescu 018 * @author Florent Guillaume 019 */ 020public class OrderByClause extends Clause { 021 022 private static final long serialVersionUID = 1L; 023 024 public final OrderByList elements; 025 026 public OrderByClause(OrderByList orderBy) { 027 this(orderBy, false); 028 } 029 030 public OrderByClause(OrderByList orderBy, boolean isDescendent) { 031 super("ORDER BY"); 032 elements = orderBy; 033 } 034 035 @Override 036 public boolean equals(Object obj) { 037 if (this == obj) { 038 return true; 039 } 040 if (obj instanceof OrderByClause) { 041 return elements.equals(((OrderByClause) obj).elements); 042 } 043 return false; 044 } 045 046 @Override 047 public int hashCode() { 048 return elements.hashCode(); 049 } 050 051 @Override 052 public void accept(IVisitor visitor) { 053 visitor.visitOrderByClause(this); 054 } 055 056 @Override 057 public String toString() { 058 return elements.toString(); 059 } 060 061}