From d5c7e714d12c5534be725f2e1a67fd115536045f Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 11 Jan 2013 11:17:12 +0100 Subject: [PATCH] [#2113] Document Record.hashCode() and equals() through Javadoc --- jOOQ/src/main/java/org/jooq/Record.java | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/Record.java b/jOOQ/src/main/java/org/jooq/Record.java index d5982961f4..fc806e34a5 100644 --- a/jOOQ/src/main/java/org/jooq/Record.java +++ b/jOOQ/src/main/java/org/jooq/Record.java @@ -861,6 +861,58 @@ public interface Record extends FieldProvider, Attachable, Comparable { // Inherited methods // ------------------------------------------------------------------------- + /** + * Get a hash code of this Record, based on the underlying row + * value expression + *

+ * In order to fulfill the general contract of {@link Object#hashCode()} and + * {@link Object#equals(Object)}, a Record's hash code value + * depends on all hash code values of this Record's underlying + * column values. + * + * @return A hash code value for this record + * @see #equals(Object) + */ + @Override + int hashCode(); + + /** + * Compare this Record with another Record for + * equality. + *

+ * Two records are considered equal if + *

+ *

+ * Note, that the above rules correspond to the SQL comparison predicate + * behaviour as illustrated in the following example:

+     * -- A row value expression comparison predicate
+     * SELECT *
+     * FROM my_table
+     * WHERE (1, 'A') = (1, 'A')
+     * 
+ *

+ * Unlike SQL, jOOQ allows to compare also incompatible records, e.g. + * records + *

+ *

+ * It can be said that for all R1, R2, if R1.equal(R2), then + * R1.compareTo(R2) == 0 + * + * @param other The other record + * @return Whether the two records are equal + * @see #compareTo(Record) + * @see #hashCode() + */ + @Override + boolean equals(Object other); + /** * Compares this Record with another Record * according to their natural ordering.