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 * Florent Guillaume 011 */ 012 013package org.nuxeo.ecm.core.query.sql.model; 014 015import java.util.ArrayList; 016import java.util.List; 017 018import org.nuxeo.common.utils.StringUtils; 019 020/** 021 * @author Florent Guillaume 022 */ 023public class OrderByList extends ArrayList<OrderByExpr> implements Operand { 024 025 private static final long serialVersionUID = 1L; 026 027 public OrderByList(OrderByExpr expr) { 028 add(expr); 029 } 030 031 @Override 032 public void accept(IVisitor visitor) { 033 visitor.visitOrderByList(this); 034 } 035 036 @Override 037 public String toString() { 038 List<String> list = new ArrayList<String>(size()); 039 for (OrderByExpr expr : this) { 040 list.add(expr.toString()); 041 } 042 return StringUtils.join(list, ", "); 043 } 044 045}