[#2179] Add Javadoc to QueryPart.hashCode() and equals()

This commit is contained in:
Lukas Eder 2013-02-09 12:04:17 +01:00
parent 345c44f656
commit db3049fd48
2 changed files with 40 additions and 1 deletions

View File

@ -119,7 +119,10 @@ public interface Field<T> extends GroupField {
Field<T> as(String alias);
/**
* Watch out! This is {@link Object#equals(Object)}, not a jOOQ feature! :-)
* {@inheritDoc}
* <p>
* <strong>Watch out! This is {@link Object#equals(Object)}, not a jOOQ DSL
* feature! :-).</strong>
*/
@Override
boolean equals(Object other);

View File

@ -62,4 +62,40 @@ public interface QueryPart extends Serializable {
*/
@Override
String toString();
/**
* Check whether this <code>QueryPart</code> can be considered equal to
* another <code>QueryPart</code>.
* <p>
* In general, <code>QueryPart</code> 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.
* <p>
* Some <code>QueryPart</code> 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 <code>QueryPart</code>
* @return Whether the two query parts are equal
*/
@Override
boolean equals(Object object);
/**
* Generate a hash code from this <code>QueryPart</code>.
* <p>
* In general, <code>QueryPart</code> hash codes are the same as the hash
* codes generated from {@link #toString()}. This guarantees consistent
* behaviour with {@link #equals(Object)}
* <p>
* Some <code>QueryPart</code> implementations may choose to override this
* behaviour for improved performance, as {@link #toString()} is an
* expensive operation, if called many times.
*
* @return The <code>QueryPart</code> hash code
*/
@Override
int hashCode();
}