diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java
index 71ebaa3d49..c95e1995d7 100644
--- a/jOOQ/src/main/java/org/jooq/Field.java
+++ b/jOOQ/src/main/java/org/jooq/Field.java
@@ -169,40 +169,6 @@ extends
@Override
String getComment();
- /**
- * The field's underlying {@link Converter}.
- *
- * By default, all fields reference an identity-converter
- * Converter<T, T>. Custom data types may be obtained by a
- * custom {@link Converter} placed on the generated {@link TableField}.
- */
- @Override
- Converter, T> getConverter();
-
- /**
- * The field's underlying {@link Binding}.
- */
- @Override
- Binding, T> getBinding();
-
- /**
- * 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);
-
/**
* Create an alias for this field.
*
diff --git a/jOOQ/src/main/java/org/jooq/Parameter.java b/jOOQ/src/main/java/org/jooq/Parameter.java
index 409ac70205..c5eb41e144 100644
--- a/jOOQ/src/main/java/org/jooq/Parameter.java
+++ b/jOOQ/src/main/java/org/jooq/Parameter.java
@@ -48,36 +48,7 @@ package org.jooq;
* @param The parameter type
* @author Lukas Eder
*/
-public interface Parameter extends Named {
-
- /**
- * The Java type of the parameter.
- */
- Class getType();
-
- /**
- * The parameter's underlying {@link Converter}.
- *
- * By default, all parameters reference an identity-converter
- * Converter<T, T>. Custom data types may be obtained by a
- * custom {@link Converter} placed on the generated {@link Parameter}.
- */
- Converter, T> getConverter();
-
- /**
- * The parameter's underlying {@link Binding}.
- */
- Binding, T> getBinding();
-
- /**
- * The type of this parameter (might not be dialect-specific)
- */
- DataType getDataType();
-
- /**
- * The dialect-specific type of this parameter
- */
- DataType getDataType(Configuration configuration);
+public interface Parameter extends Named, Typed {
/**
* Whether this parameter has a default value
diff --git a/jOOQ/src/main/java/org/jooq/Period.java b/jOOQ/src/main/java/org/jooq/Period.java
index 7a56b7b348..6861747f0f 100644
--- a/jOOQ/src/main/java/org/jooq/Period.java
+++ b/jOOQ/src/main/java/org/jooq/Period.java
@@ -115,35 +115,6 @@ package org.jooq;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jOOQ/src/main/java/org/jooq/SelectField.java b/jOOQ/src/main/java/org/jooq/SelectField.java
index e5ac0fe77a..c4a4d22cc9 100644
--- a/jOOQ/src/main/java/org/jooq/SelectField.java
+++ b/jOOQ/src/main/java/org/jooq/SelectField.java
@@ -46,39 +46,6 @@ package org.jooq;
*
* @author Lukas Eder
*/
-public interface SelectField extends SelectFieldOrAsterisk, Named {
-
- // ------------------------------------------------------------------------
- // API
- // ------------------------------------------------------------------------
-
- /**
- * The field's underlying {@link Converter}.
- *
- * By default, all fields reference an identity-converter
- * Converter<T, T>. Custom data types may be obtained by a
- * custom {@link Converter} placed on the generated {@link TableField}.
- */
- Converter, T> getConverter();
-
- /**
- * The field's underlying {@link Binding}.
- */
- Binding, T> getBinding();
-
- /**
- * The Java type of the field.
- */
- Class getType();
-
- /**
- * The type of this field (might not be dialect-specific).
- */
- DataType getDataType();
-
- /**
- * The dialect-specific type of this field.
- */
- DataType getDataType(Configuration configuration);
+public interface SelectField extends SelectFieldOrAsterisk, Named, Typed {
}
diff --git a/jOOQ/src/main/java/org/jooq/Sequence.java b/jOOQ/src/main/java/org/jooq/Sequence.java
index 297822ce11..ee8273813b 100644
--- a/jOOQ/src/main/java/org/jooq/Sequence.java
+++ b/jOOQ/src/main/java/org/jooq/Sequence.java
@@ -64,7 +64,7 @@ import org.jooq.impl.DSL;
*
* @author Lukas Eder
*/
-public interface Sequence extends Named {
+public interface Sequence extends Named, Typed {
/**
* Get the sequence catalog.
@@ -76,11 +76,6 @@ public interface Sequence extends Named {
*/
Schema getSchema();
- /**
- * Get the sequence data type.
- */
- DataType getDataType();
-
/**
* Get the start value for this sequence or null, if no such
* value is specified.
diff --git a/jOOQ/src/main/java/org/jooq/Typed.java b/jOOQ/src/main/java/org/jooq/Typed.java
new file mode 100644
index 0000000000..3ad04b488a
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/Typed.java
@@ -0,0 +1,80 @@
+/*
+ * 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 marker interface for all query parts that have a {@link DataType}.
+ *
+ * While there is no requirement for implementations to also implement
+ * {@link Named}, a lot of implementations do.
+ *
+ * @author Lukas Eder
+ */
+public interface Typed extends QueryPart {
+
+ /**
+ * The object's underlying {@link Converter}.
+ *
+ * By default, all typed objects reference an identity-converter
+ * Converter<T, T>. If an implementation is generated,
+ * custom data types may be obtained by a custom {@link Converter} placed on
+ * the generated object.
+ */
+ Converter, T> getConverter();
+
+ /**
+ * The object's underlying {@link Binding}.
+ */
+ Binding, T> getBinding();
+
+ /**
+ * The Java type of the 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/impl/AbstractField.java b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java
index d47587c186..f30ecafbfa 100644
--- a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java
+++ b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java
@@ -86,9 +86,7 @@ import org.jooq.Collation;
import org.jooq.Comment;
import org.jooq.Comparator;
import org.jooq.Condition;
-import org.jooq.Configuration;
import org.jooq.Context;
-import org.jooq.Converter;
import org.jooq.DataType;
import org.jooq.DatePart;
import org.jooq.Field;
@@ -108,7 +106,7 @@ import org.jooq.WindowPartitionByStep;
/**
* @author Lukas Eder
*/
-abstract class AbstractField extends AbstractNamed implements Field {
+abstract class AbstractField extends AbstractTypedNamed implements Field {
/**
* Generated UID
@@ -116,8 +114,6 @@ abstract class AbstractField extends AbstractNamed implements Field {
private static final long serialVersionUID = 2884811923648354905L;
private static final Clause[] CLAUSES = { FIELD };
- private final DataType dataType;
-
AbstractField(Name name, DataType type) {
this(name, type, null);
}
@@ -128,9 +124,7 @@ abstract class AbstractField extends AbstractNamed implements Field {
@SuppressWarnings("unchecked")
AbstractField(Name name, DataType type, Comment comment, Binding, T> binding) {
- super(name, comment);
-
- this.dataType = type.asConvertedDataType((Binding) binding);
+ super(name, comment, type.asConvertedDataType((Binding) binding));
}
// ------------------------------------------------------------------------
@@ -212,31 +206,6 @@ abstract class AbstractField extends AbstractNamed implements Field {
- @Override
- public final Converter, T> getConverter() {
- return getBinding().converter();
- }
-
- @Override
- public final Binding, T> getBinding() {
- return dataType.getBinding();
- }
-
- @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();
- }
-
// ------------------------------------------------------------------------
// XXX: Type casts
// ------------------------------------------------------------------------
diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTypedNamed.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTypedNamed.java
new file mode 100644
index 0000000000..84fe3b89df
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTypedNamed.java
@@ -0,0 +1,91 @@
+/*
+ * 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 org.jooq.Binding;
+import org.jooq.Comment;
+import org.jooq.Configuration;
+import org.jooq.Converter;
+import org.jooq.DataType;
+import org.jooq.Name;
+import org.jooq.Typed;
+
+/**
+ * @author Lukas Eder
+ */
+abstract class AbstractTypedNamed extends AbstractNamed implements Typed {
+
+ private static final long serialVersionUID = 4569512766643813958L;
+ private final DataType type;
+
+ AbstractTypedNamed(Name name, Comment comment, DataType type) {
+ super(name, comment);
+
+ this.type = type;
+ }
+
+ // -------------------------------------------------------------------------
+ // XXX: Typed API
+ // -------------------------------------------------------------------------
+
+ @Override
+ public final Converter, T> getConverter() {
+ return type.getConverter();
+ }
+
+ @Override
+ public final Binding, T> getBinding() {
+ return type.getBinding();
+ }
+
+ @Override
+ public final Class getType() {
+ return type.getType();
+ }
+
+ @Override
+ public final DataType getDataType() {
+ return type;
+ }
+
+ @Override
+ public final DataType getDataType(Configuration configuration) {
+ return type.getDataType(configuration);
+ }
+}
diff --git a/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java
index ceaa138179..7f72b04473 100644
--- a/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/ParameterImpl.java
@@ -39,9 +39,7 @@
package org.jooq.impl;
import org.jooq.Binding;
-import org.jooq.Configuration;
import org.jooq.Context;
-import org.jooq.Converter;
import org.jooq.DataType;
import org.jooq.Parameter;
@@ -50,48 +48,21 @@ import org.jooq.Parameter;
*
* @author Lukas Eder
*/
-final class ParameterImpl extends AbstractNamed implements Parameter {
+final class ParameterImpl extends AbstractTypedNamed implements Parameter {
private static final long serialVersionUID = -5277225593751085577L;
- private final DataType type;
private final boolean isDefaulted;
private final boolean isUnnamed;
@SuppressWarnings("unchecked")
ParameterImpl(String name, DataType type, Binding, T> binding, boolean isDefaulted, boolean isUnnamed) {
- super(DSL.name(name), CommentImpl.NO_COMMENT);
+ super(DSL.name(name), CommentImpl.NO_COMMENT, type.asConvertedDataType((Binding) binding));
- this.type = type.asConvertedDataType((Binding) binding);
this.isDefaulted = isDefaulted;
this.isUnnamed = isUnnamed;
}
- @Override
- public final Converter, T> getConverter() {
- return type.getBinding().converter();
- }
-
- @Override
- public final Binding, T> getBinding() {
- return type.getBinding();
- }
-
- @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 accept(Context> ctx) {
ctx.visit(getUnqualifiedName());
diff --git a/jOOQ/src/main/java/org/jooq/impl/PeriodImpl.java b/jOOQ/src/main/java/org/jooq/impl/PeriodImpl.java
index f292852914..85e9392ad3 100644
--- a/jOOQ/src/main/java/org/jooq/impl/PeriodImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/PeriodImpl.java
@@ -129,39 +129,6 @@ package org.jooq.impl;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jOOQ/src/main/java/org/jooq/impl/SequenceImpl.java b/jOOQ/src/main/java/org/jooq/impl/SequenceImpl.java
index 9c3ddbba6f..8abc303774 100644
--- a/jOOQ/src/main/java/org/jooq/impl/SequenceImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/SequenceImpl.java
@@ -76,7 +76,7 @@ import org.jooq.exception.SQLDialectNotSupportedException;
* @author Lukas Eder
*/
@org.jooq.Internal
-public class SequenceImpl extends AbstractNamed implements Sequence {
+public class SequenceImpl extends AbstractTypedNamed implements Sequence {
/**
* Generated UID
@@ -86,7 +86,6 @@ public class SequenceImpl extends AbstractNamed implements Seq
private final boolean nameIsPlainSQL;
private final Schema schema;
- private final DataType type;
private final Field startWith;
private final Field incrementBy;
private final Field minvalue;
@@ -107,12 +106,21 @@ public class SequenceImpl extends AbstractNamed implements Seq
this(name, schema, type, nameIsPlainSQL, null, null, null, null, false, null);
}
- SequenceImpl(Name name, Schema schema, DataType type, boolean nameIsPlainSQL,
- Field startWith, Field incrementBy, Field minvalue, Field maxvalue, boolean cycle, Field cache) {
- super(qualify(schema, name), CommentImpl.NO_COMMENT);
+ SequenceImpl(
+ Name name,
+ Schema schema,
+ DataType type,
+ boolean nameIsPlainSQL,
+ Field startWith,
+ Field incrementBy,
+ Field minvalue,
+ Field maxvalue,
+ boolean cycle,
+ Field cache
+ ) {
+ super(qualify(schema, name), CommentImpl.NO_COMMENT, type);
this.schema = schema;
- this.type = type;
this.nameIsPlainSQL = nameIsPlainSQL;
this.startWith = startWith;
@@ -133,11 +141,6 @@ public class SequenceImpl extends AbstractNamed implements Seq
return schema;
}
- @Override
- public final DataType getDataType() {
- return type;
- }
-
@Override
public final Field getStartWith() {
return startWith;
@@ -200,7 +203,7 @@ public class SequenceImpl extends AbstractNamed implements Seq
private final SequenceMethod method;
SequenceFunction(SequenceMethod method) {
- super(method.name, type);
+ super(method.name, SequenceImpl.this.getDataType());
this.method = method;
}