Remove unnecessary internal class

This commit is contained in:
Lukas Eder 2014-08-12 13:07:48 +02:00
parent 4671f14aae
commit 68292553da
3 changed files with 8 additions and 72 deletions

View File

@ -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);
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}