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 * Nuxeo - initial API and implementation 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.ecm.core.query.sql.model; 016 017import java.util.List; 018 019/** 020 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 021 */ 022public class GroupByClause extends Clause { 023 024 private static final long serialVersionUID = 3007583185472406626L; 025 026 public final String[] elements; 027 028 public GroupByClause() { 029 super("GROUP BY"); 030 elements = new String[0]; 031 } 032 033 public GroupByClause(String[] groupBy) { 034 super("GROUP BY"); 035 elements = groupBy; 036 } 037 038 public GroupByClause(String groupBy) { 039 super("GROUP BY"); 040 elements = new String[] { groupBy }; 041 } 042 043 public GroupByClause(List<String> groupBy) { 044 super("GROUP BY"); 045 elements = groupBy.toArray(new String[groupBy.size()]); 046 } 047 048 @Override 049 public void accept(IVisitor visitor) { 050 visitor.visitGroupByClause(this); 051 } 052 053}