diff --git a/jOOQ/src/main/java/org/jooq/Queries.java b/jOOQ/src/main/java/org/jooq/Queries.java new file mode 100644 index 0000000000..78b6ebd00d --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Queries.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com) + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A wrapper for a collection of queries. + * + * @author Lukas Eder + */ +public interface Queries { + + /** + * The wrapped collection of queries. + */ + Query[] queries(); +} diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 3e2166a316..e9f1d46bb8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -189,6 +189,7 @@ import org.jooq.OrderedAggregateFunctionOfDeferredType; import org.jooq.Param; import org.jooq.PlainSQL; import org.jooq.QuantifiedSelect; +import org.jooq.Queries; import org.jooq.Query; import org.jooq.QueryPart; import org.jooq.Record; @@ -6571,6 +6572,26 @@ public class DSL { return new QualifiedField(name, type); } + // ------------------------------------------------------------------------- + // XXX: Queries + // ------------------------------------------------------------------------- + + /** + * Wrap a collection of queries. + */ + @Support + public static Queries queries(Query... queries) { + return queries(Arrays.asList(queries)); + } + + /** + * Wrap a collection of queries. + */ + @Support + public static Queries queries(Collection queries) { + return new QueriesImpl(queries); + } + diff --git a/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java b/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java new file mode 100644 index 0000000000..f7f6430ed4 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com) + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import java.util.Collection; + +import org.jooq.Queries; +import org.jooq.Query; + +/** + * @author Lukas Eder + */ +class QueriesImpl implements Queries { + + private final Collection queries; + + QueriesImpl(Collection queries) { + this.queries = queries; + } + + @Override + public final Query[] queries() { + return queries.toArray(new Query[0]); + } +}