From 156c69e6bacdb1dafff73c369bdd38c8d9a09c01 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 26 Oct 2012 20:04:00 +0200 Subject: [PATCH] [#1887] Remove all deprecated code --- jOOQ/src/main/java/org/jooq/Field.java | 5 +- .../org/jooq/NamedTypeProviderQueryPart.java | 66 ---------------- jOOQ/src/main/java/org/jooq/Parameter.java | 5 +- jOOQ/src/main/java/org/jooq/SortField.java | 2 +- .../java/org/jooq/impl/AbstractField.java | 23 +++++- .../AbstractNamedTypeProviderQueryPart.java | 77 ------------------- jOOQ/src/main/java/org/jooq/impl/Cast.java | 4 + .../java/org/jooq/impl/ParameterImpl.java | 22 +++++- .../main/java/org/jooq/impl/ResultImpl.java | 4 +- .../java/org/jooq/impl/SortFieldImpl.java | 4 +- 10 files changed, 51 insertions(+), 161 deletions(-) delete mode 100644 jOOQ/src/main/java/org/jooq/NamedTypeProviderQueryPart.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/AbstractNamedTypeProviderQueryPart.java diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java index a7419cbf05..d52090dbf6 100644 --- a/jOOQ/src/main/java/org/jooq/Field.java +++ b/jOOQ/src/main/java/org/jooq/Field.java @@ -66,7 +66,7 @@ import org.jooq.util.oracle.OracleFactory; * @author Lukas Eder */ @SuppressWarnings("deprecation") -public interface Field extends NamedTypeProviderQueryPart { +public interface Field extends NamedQueryPart { // ------------------------------------------------------------------------ // API @@ -89,19 +89,16 @@ public interface Field extends NamedTypeProviderQueryPart { /** * The Java type of the field. */ - @Override Class getType(); /** * The type of this field (might not be dialect-specific) */ - @Override DataType getDataType(); /** * The dialect-specific type of this field */ - @Override DataType getDataType(Configuration configuration); /** diff --git a/jOOQ/src/main/java/org/jooq/NamedTypeProviderQueryPart.java b/jOOQ/src/main/java/org/jooq/NamedTypeProviderQueryPart.java deleted file mode 100644 index 4b8e1aa571..0000000000 --- a/jOOQ/src/main/java/org/jooq/NamedTypeProviderQueryPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com - * All rights reserved. - * - * This software is licensed to you under the Apache License, Version 2.0 - * (the "License"); You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * . Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * . Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * . Neither the name "jOOQ" nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -package org.jooq; - -/** - * Any object providing a type. - * - * @param The type provided by this type provider - * @author Lukas Eder - * @deprecated - 2.6.0 [#1870] - This marker interface does not have enough - * momentum to be exposed in the public API. It will be removed in - * the future. - */ -@Deprecated -public interface NamedTypeProviderQueryPart extends NamedQueryPart { - - /** - * The type of this object - */ - Class getType(); - - /** - * The type of this object (might not be dialect-specific) - */ - DataType getDataType(); - - /** - * The dialect-specific type of this object - */ - DataType getDataType(Configuration configuration); - -} diff --git a/jOOQ/src/main/java/org/jooq/Parameter.java b/jOOQ/src/main/java/org/jooq/Parameter.java index 10982a13d0..e7d4d3826f 100644 --- a/jOOQ/src/main/java/org/jooq/Parameter.java +++ b/jOOQ/src/main/java/org/jooq/Parameter.java @@ -45,7 +45,7 @@ import static org.jooq.SQLDialect.ORACLE; * @author Lukas Eder */ @SuppressWarnings("deprecation") -public interface Parameter extends NamedTypeProviderQueryPart { +public interface Parameter extends NamedQueryPart { /** * The name of this parameter @@ -56,19 +56,16 @@ public interface Parameter extends NamedTypeProviderQueryPart { /** * The Java type of the parameter. */ - @Override Class getType(); /** * The type of this parameter (might not be dialect-specific) */ - @Override DataType getDataType(); /** * The dialect-specific type of this parameter */ - @Override DataType getDataType(Configuration configuration); /** diff --git a/jOOQ/src/main/java/org/jooq/SortField.java b/jOOQ/src/main/java/org/jooq/SortField.java index 18d510cad3..a80acb7ee4 100644 --- a/jOOQ/src/main/java/org/jooq/SortField.java +++ b/jOOQ/src/main/java/org/jooq/SortField.java @@ -44,7 +44,7 @@ package org.jooq; * @see Field#desc() */ @SuppressWarnings("deprecation") -public interface SortField extends NamedTypeProviderQueryPart { +public interface SortField extends NamedQueryPart { /** * The name of this sort field diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java index 28daed19a1..78aa0fa9d2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java @@ -62,6 +62,7 @@ import org.jooq.CaseValueStep; import org.jooq.CaseWhenStep; import org.jooq.Comparator; import org.jooq.Condition; +import org.jooq.Configuration; import org.jooq.DataType; import org.jooq.DatePart; import org.jooq.Field; @@ -73,15 +74,18 @@ import org.jooq.WindowIgnoreNullsStep; import org.jooq.WindowPartitionByStep; import org.jooq.tools.Convert; -abstract class AbstractField extends AbstractNamedTypeProviderQueryPart implements Field { +abstract class AbstractField extends AbstractNamedQueryPart implements Field { /** * Generated UID */ private static final long serialVersionUID = 2884811923648354905L; + private final DataType dataType; AbstractField(String name, DataType type) { - super(name, type); + super(name); + + this.dataType = type; } // ------------------------------------------------------------------------ @@ -106,6 +110,21 @@ abstract class AbstractField extends AbstractNamedTypeProviderQueryPart im return new FieldAlias(this, alias); } + @Override + public final DataType getDataType() { + return dataType; + } + + @Override + public final DataType getDataType(Configuration configuration) { + return dataType.getDataType(configuration); + } + + @Override + public final Class getType() { + return dataType.getType(); + } + // ------------------------------------------------------------------------ // Type casts // ------------------------------------------------------------------------ diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractNamedTypeProviderQueryPart.java b/jOOQ/src/main/java/org/jooq/impl/AbstractNamedTypeProviderQueryPart.java deleted file mode 100644 index 24fffd2408..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractNamedTypeProviderQueryPart.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2009-2012, Lukas Eder, lukas.eder@gmail.com - * All rights reserved. - * - * This software is licensed to you under the Apache License, Version 2.0 - * (the "License"); You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * . Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * . Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * . Neither the name "jOOQ" nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -package org.jooq.impl; - -import org.jooq.Configuration; -import org.jooq.DataType; -import org.jooq.NamedTypeProviderQueryPart; - -/** - * @author Lukas Eder - */ -@SuppressWarnings("deprecation") -abstract class AbstractNamedTypeProviderQueryPart extends AbstractNamedQueryPart implements - NamedTypeProviderQueryPart { - - private static final long serialVersionUID = -9087742153758783482L; - private final DataType type; - - AbstractNamedTypeProviderQueryPart(String name, DataType type) { - super(name); - - this.type = type; - } - - @Override - public final DataType getDataType() { - return type; - } - - protected final SQLDataType getSQLDataType() { - return type.getSQLDataType(); - } - - @Override - public final DataType getDataType(Configuration configuration) { - return type.getDataType(configuration); - } - - @Override - public final Class getType() { - return type.getType(); - } -} \ No newline at end of file diff --git a/jOOQ/src/main/java/org/jooq/impl/Cast.java b/jOOQ/src/main/java/org/jooq/impl/Cast.java index 4b32057517..926eb80778 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Cast.java +++ b/jOOQ/src/main/java/org/jooq/impl/Cast.java @@ -68,6 +68,10 @@ class Cast extends AbstractField { this.field = field; } + private final SQLDataType getSQLDataType() { + return getDataType().getSQLDataType(); + } + @SuppressWarnings("unchecked") @Override public final void toSQL(RenderContext context) { diff --git a/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java index 8d7fe3d2c8..aaff2c225d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java @@ -37,6 +37,7 @@ package org.jooq.impl; import org.jooq.BindContext; +import org.jooq.Configuration; import org.jooq.DataType; import org.jooq.Parameter; import org.jooq.RenderContext; @@ -46,18 +47,35 @@ import org.jooq.RenderContext; * * @author Lukas Eder */ -class ParameterImpl extends AbstractNamedTypeProviderQueryPart implements Parameter { +class ParameterImpl extends AbstractNamedQueryPart implements Parameter { private static final long serialVersionUID = -5277225593751085577L; private final boolean isDefaulted; + private final DataType type; ParameterImpl(String name, DataType type, boolean isDefaulted) { - super(name, type); + super(name); + this.type = type; this.isDefaulted = isDefaulted; } + @Override + public final DataType getDataType() { + return type; + } + + @Override + public final DataType getDataType(Configuration configuration) { + return type.getDataType(configuration); + } + + @Override + public final Class getType() { + return type.getType(); + } + @Override public final void bind(BindContext context) {} diff --git a/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java b/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java index fc43c328e5..9697da757f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ResultImpl.java @@ -70,7 +70,6 @@ import org.jooq.Record; import org.jooq.RecordHandler; import org.jooq.RecordMapper; import org.jooq.Result; -import org.jooq.Store; import org.jooq.Table; import org.jooq.exception.InvalidResultException; import org.jooq.tools.Convert; @@ -84,7 +83,6 @@ import org.w3c.dom.Element; * @author Lukas Eder * @author Ivan Dugic */ -@SuppressWarnings("deprecation") class ResultImpl implements Result, AttachableInternal { /** @@ -120,7 +118,7 @@ class ResultImpl implements Result, AttachableInternal { public final List getAttachables() { List result = new ArrayList(); - for (Store item : records) { + for (Attachable item : records) { if (item != null) { result.add(item); } diff --git a/jOOQ/src/main/java/org/jooq/impl/SortFieldImpl.java b/jOOQ/src/main/java/org/jooq/impl/SortFieldImpl.java index c5afa87590..c5bedcbe06 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SortFieldImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SortFieldImpl.java @@ -45,7 +45,7 @@ import org.jooq.RenderContext; import org.jooq.SortField; import org.jooq.SortOrder; -class SortFieldImpl extends AbstractNamedTypeProviderQueryPart implements SortField { +class SortFieldImpl extends AbstractNamedQueryPart implements SortField { /** * Generated UID @@ -58,7 +58,7 @@ class SortFieldImpl extends AbstractNamedTypeProviderQueryPart implements private boolean nullsLast; SortFieldImpl(Field field, SortOrder order) { - super(field.getName(), field.getDataType()); + super(field.getName()); this.field = field; this.order = order;