From cb0a9249e58882cb6c8095108ffd0f52cfdeed82 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Fri, 2 Jun 2017 10:36:08 +0200 Subject: [PATCH] [#6306] Add org.jooq.True and org.jooq.False --- jOOQ/src/main/java/org/jooq/False.java | 44 +++++++++++++++++++ jOOQ/src/main/java/org/jooq/True.java | 44 +++++++++++++++++++ jOOQ/src/main/java/org/jooq/impl/DSL.java | 6 ++- .../java/org/jooq/impl/FalseCondition.java | 3 +- .../java/org/jooq/impl/TrueCondition.java | 3 +- 5 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/False.java create mode 100644 jOOQ/src/main/java/org/jooq/True.java diff --git a/jOOQ/src/main/java/org/jooq/False.java b/jOOQ/src/main/java/org/jooq/False.java new file mode 100644 index 0000000000..139f1a8483 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/False.java @@ -0,0 +1,44 @@ +/* + * 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 predicate that always yields false. + * + * @author Lukas Eder + */ +public interface False extends Condition { + +} diff --git a/jOOQ/src/main/java/org/jooq/True.java b/jOOQ/src/main/java/org/jooq/True.java new file mode 100644 index 0000000000..d1c6615842 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/True.java @@ -0,0 +1,44 @@ +/* + * 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 predicate that always yields true. + * + * @author Lukas Eder + */ +public interface True extends Condition { + +} diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 33c109ea07..b0265df20b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -154,6 +154,7 @@ import org.jooq.DropSchemaStep; import org.jooq.DropSequenceFinalStep; import org.jooq.DropTableStep; import org.jooq.DropViewFinalStep; +import org.jooq.False; import org.jooq.Field; import org.jooq.FieldOrRow; import org.jooq.GroupConcatOrderByStep; @@ -282,6 +283,7 @@ import org.jooq.SortField; import org.jooq.Support; import org.jooq.Table; import org.jooq.TableLike; +import org.jooq.True; import org.jooq.TruncateIdentityStep; import org.jooq.UDTRecord; import org.jooq.Update; @@ -10242,7 +10244,7 @@ public class DSL { * Return a Condition that will always evaluate to true. */ @Support - public static Condition trueCondition() { + public static True trueCondition() { return new TrueCondition(); } @@ -10250,7 +10252,7 @@ public class DSL { * Return a Condition that will always evaluate to false. */ @Support - public static Condition falseCondition() { + public static False falseCondition() { return new FalseCondition(); } diff --git a/jOOQ/src/main/java/org/jooq/impl/FalseCondition.java b/jOOQ/src/main/java/org/jooq/impl/FalseCondition.java index 0d71a55d44..bf10cef4b2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/FalseCondition.java +++ b/jOOQ/src/main/java/org/jooq/impl/FalseCondition.java @@ -39,11 +39,12 @@ import static org.jooq.Clause.CONDITION_COMPARISON; import org.jooq.Clause; import org.jooq.Context; +import org.jooq.False; /** * @author Lukas Eder */ -final class FalseCondition extends AbstractCondition { +final class FalseCondition extends AbstractCondition implements False { private static final long serialVersionUID = -3972466479081463547L; private static final Clause[] CLAUSES = { CONDITION, CONDITION_COMPARISON }; diff --git a/jOOQ/src/main/java/org/jooq/impl/TrueCondition.java b/jOOQ/src/main/java/org/jooq/impl/TrueCondition.java index c0246ce5c3..ca414afb97 100644 --- a/jOOQ/src/main/java/org/jooq/impl/TrueCondition.java +++ b/jOOQ/src/main/java/org/jooq/impl/TrueCondition.java @@ -40,11 +40,12 @@ import static org.jooq.Clause.CONDITION_COMPARISON; import org.jooq.Clause; import org.jooq.Context; +import org.jooq.True; /** * @author Lukas Eder */ -final class TrueCondition extends AbstractCondition { +final class TrueCondition extends AbstractCondition implements True { private static final long serialVersionUID = 775364624704563687L; private static final Clause[] CLAUSES = { CONDITION, CONDITION_COMPARISON };