Skip to content

Commit d995ce0

Browse files
committed
AggregateQuerySnapshot.java: re-write the javadocs
1 parent 1c8e6e1 commit d995ce0

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/AggregateQuery.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ public boolean equals(Object object) {
9595
return query.equals(other.query);
9696
}
9797

98+
/**
99+
* Calculates and returns the hash code for this object.
100+
* @return the hash code for this object.
101+
*/
98102
@Override
99103
public int hashCode() {
100104
return query.hashCode();

firebase-firestore/src/main/java/com/google/firebase/firestore/AggregateQuerySnapshot.java

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.Objects;
2121

2222
/**
23-
* A {@code AggregateQuerySnapshot} contains results of a {@link AggregateQuery}.
23+
* The results of executing an {@link AggregateQuery}.
2424
*
2525
* <p><b>Subclassing Note</b>: Cloud Firestore classes are not meant to be subclassed except for use
2626
* in test mocks. Subclassing is not supported in production code and new SDK releases may break
@@ -37,25 +37,45 @@ public class AggregateQuerySnapshot {
3737
this.count = count;
3838
}
3939

40-
/** @return The original {@link AggregateQuery} this snapshot is a result of. */
40+
/** Returns the query that was executed to produce this result. */
4141
@NonNull
4242
public AggregateQuery getQuery() {
4343
return query;
4444
}
4545

46-
/** @return The result of a document count aggregation. */
46+
/** Returns the number of documents in the result set of the query. */
4747
public long getCount() {
4848
return count;
4949
}
5050

51+
/**
52+
* Compares this object with the given object for equality.
53+
*
54+
* <p>This object is considered "equal" to the other object if and only if all of the following
55+
* conditions are satisfied:
56+
*
57+
* <ol>
58+
* <li>{@code object} is a non-null instance of {@link AggregateQuerySnapshot}.</li>
59+
* <li>{@code object} has the same {@link AggregateQuery} as this object.</li>
60+
* <li>{@code object} has the same results as this object.</li>
61+
* </ol>
62+
*
63+
* @param object The object to compare to this object for equality.
64+
* @return {@code true} if this object is "equal" to the given object, as defined above, or
65+
* {@code false} otherwise.
66+
*/
5167
@Override
52-
public boolean equals(Object o) {
53-
if (this == o) return true;
54-
if (!(o instanceof AggregateQuerySnapshot)) return false;
55-
AggregateQuerySnapshot snapshot = (AggregateQuerySnapshot) o;
56-
return count == snapshot.count && query.equals(snapshot.query);
68+
public boolean equals(Object object) {
69+
if (this == object) return true;
70+
if (!(object instanceof AggregateQuerySnapshot)) return false;
71+
AggregateQuerySnapshot other = (AggregateQuerySnapshot) object;
72+
return count == other.count && query.equals(other.query);
5773
}
5874

75+
/**
76+
* Calculates and returns the hash code for this object.
77+
* @return the hash code for this object.
78+
*/
5979
@Override
6080
public int hashCode() {
6181
return Objects.hash(count, query);

0 commit comments

Comments
 (0)