diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java index 941f3d02c6..96b47c5b04 100644 --- a/jOOQ/src/main/java/org/jooq/Field.java +++ b/jOOQ/src/main/java/org/jooq/Field.java @@ -119,7 +119,10 @@ public interface Field extends GroupField { Field as(String alias); /** - * Watch out! This is {@link Object#equals(Object)}, not a jOOQ feature! :-) + * {@inheritDoc} + *

+ * Watch out! This is {@link Object#equals(Object)}, not a jOOQ DSL + * feature! :-). */ @Override boolean equals(Object other); diff --git a/jOOQ/src/main/java/org/jooq/QueryPart.java b/jOOQ/src/main/java/org/jooq/QueryPart.java index 0e9e498849..21a3d3c35f 100644 --- a/jOOQ/src/main/java/org/jooq/QueryPart.java +++ b/jOOQ/src/main/java/org/jooq/QueryPart.java @@ -62,4 +62,40 @@ public interface QueryPart extends Serializable { */ @Override String toString(); + + /** + * Check whether this QueryPart can be considered equal to + * another QueryPart. + *

+ * In general, QueryPart equality is defined in terms of + * {@link #toString()} equality. In other words, two query parts are + * considered equal if their rendered SQL (with inlined bind variables) is + * equal. This means that the two query parts do not necessarily have to be + * of the same type. + *

+ * Some QueryPart implementations may choose to override this + * behaviour for improved performance, as {@link #toString()} is an + * expensive operation, if called many times. + * + * @param object The other QueryPart + * @return Whether the two query parts are equal + */ + @Override + boolean equals(Object object); + + /** + * Generate a hash code from this QueryPart. + *

+ * In general, QueryPart hash codes are the same as the hash + * codes generated from {@link #toString()}. This guarantees consistent + * behaviour with {@link #equals(Object)} + *

+ * Some QueryPart implementations may choose to override this + * behaviour for improved performance, as {@link #toString()} is an + * expensive operation, if called many times. + * + * @return The QueryPart hash code + */ + @Override + int hashCode(); }