From 68292553da0d2cbeeff2a9637e0dc761a6e5cfce Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 12 Aug 2014 13:07:48 +0200 Subject: [PATCH] Remove unnecessary internal class --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 4 +- .../java/org/jooq/impl/ExistsOperator.java | 63 ------------------- .../impl/SelectQueryAsExistsCondition.java | 13 ++-- 3 files changed, 8 insertions(+), 72 deletions(-) delete mode 100644 jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 4ba9b7354f..26fd13b4d2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -5981,7 +5981,7 @@ public class DSL { */ @Support public static Condition exists(Select query) { - return new SelectQueryAsExistsCondition(query, ExistsOperator.EXISTS); + return new SelectQueryAsExistsCondition(query, true); } /** @@ -5991,7 +5991,7 @@ public class DSL { */ @Support public static Condition notExists(Select query) { - return new SelectQueryAsExistsCondition(query, ExistsOperator.NOT_EXISTS); + return new SelectQueryAsExistsCondition(query, false); } /** diff --git a/jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java b/jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java deleted file mode 100644 index 027098ed26..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ - -package org.jooq.impl; - -/** - * An operator for the {@link ExistsCondition} - * - * @author Lukas Eder - */ -enum ExistsOperator { - - EXISTS("exists"), - NOT_EXISTS("not exists"); - - private final String sql; - - private ExistsOperator(String sql) { - this.sql = sql; - } - - public String toSQL() { - return sql; - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java index de27fc3259..047203ed84 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java @@ -44,7 +44,6 @@ package org.jooq.impl; import static org.jooq.Clause.CONDITION; import static org.jooq.Clause.CONDITION_EXISTS; import static org.jooq.Clause.CONDITION_NOT_EXISTS; -import static org.jooq.impl.ExistsOperator.EXISTS; import org.jooq.Clause; import org.jooq.Context; @@ -60,11 +59,11 @@ class SelectQueryAsExistsCondition extends AbstractCondition { private static final Clause[] CLAUSES_EXISTS_NOT = { CONDITION, CONDITION_NOT_EXISTS }; private final Select query; - private final ExistsOperator operator; + private final boolean exists; - SelectQueryAsExistsCondition(Select query, ExistsOperator operator) { + SelectQueryAsExistsCondition(Select query, boolean exists) { this.query = query; - this.operator = operator; + this.exists = exists; } @Override @@ -72,7 +71,7 @@ class SelectQueryAsExistsCondition extends AbstractCondition { // If this is already a subquery, proceed if (ctx.subquery()) { - ctx.keyword(operator.toSQL()) + ctx.keyword(exists ? "exists" : "not exists") .sql(" (") .formatIndentStart() .formatNewLine() @@ -82,7 +81,7 @@ class SelectQueryAsExistsCondition extends AbstractCondition { .sql(")"); } else { - ctx.keyword(operator.toSQL()) + ctx.keyword(exists ? "exists" : "not exists") .sql(" (") .subquery(true) .formatIndentStart() @@ -97,6 +96,6 @@ class SelectQueryAsExistsCondition extends AbstractCondition { @Override public final Clause[] clauses(Context ctx) { - return operator == EXISTS ? CLAUSES_EXISTS : CLAUSES_EXISTS_NOT; + return exists ? CLAUSES_EXISTS : CLAUSES_EXISTS_NOT; } }