Skip to content

Commit 47f7c61

Browse files
committed
Fixes
1 parent 94e9a34 commit 47f7c61

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

driver-core/src/main/com/mongodb/client/model/expressions/Expression.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,26 @@
2626
*
2727
* TODO-END: 'cause an error', 'execution context', wrong types/unsafe operations
2828
* TODO-END: types and how missing/null are not part of any type.
29+
* TODO-END: behaviour of equals
2930
*
3031
* @see Expressions
3132
*/
3233
@Evolving
3334
public interface Expression {
3435

36+
/**
37+
* The method {@link Expression#eq} should be used to compare values for
38+
* equality.
39+
*/
40+
@Deprecated // TODO-END (?) <p>Marked deprecated to prevent erroneous use.
41+
@Override
42+
boolean equals(Object other);
43+
3544
/**
3645
* Whether {@code this} value is equal to the {@code other} value.
3746
*
47+
* <p>The result does not correlate with {@link Expression#equals(Object)}.
48+
*
3849
* @param other the other value.
3950
* @return the resulting value.
4051
*/
@@ -97,9 +108,6 @@ public interface Expression {
97108
* {@code this} is a number, or the {@code other} number value if
98109
* {@code this} is null, or is missing, or is of any other non-number type.
99110
*
100-
* <p>Since integers are a subset of numbers, if a value is an integer,
101-
* this does not imply that it is not a number, and vice-versa.
102-
*
103111
* @param other the other value.
104112
* @return the resulting value.
105113
*/
@@ -110,28 +118,25 @@ public interface Expression {
110118
* {@code this} is an integer, or the {@code other} integer value if
111119
* {@code this} is null, or is missing, or is of any other non-integer type.
112120
*
113-
* <p>Since integers are a subset of numbers, if a value is an integer,
114-
* this does not imply that it is not a number, and vice-versa.
115-
*
116121
* @param other the other value.
117122
* @return the resulting value.
118123
*/
119124
IntegerExpression isIntegerOr(IntegerExpression other);
120125

121126
/**
122-
* {@code this} value as a {@link BooleanExpression boolean} if
123-
* {@code this} is a boolean, or the {@code other} boolean value if
124-
* {@code this} is null, or is missing, or is of any other non-boolean type.
127+
* {@code this} value as a {@link StringExpression string} if
128+
* {@code this} is a string, or the {@code other} string value if
129+
* {@code this} is null, or is missing, or is of any other non-string type.
125130
*
126131
* @param other the other value.
127132
* @return the resulting value.
128133
*/
129134
StringExpression isStringOr(StringExpression other);
130135

131136
/**
132-
* {@code this} value as a {@link StringExpression string} if
133-
* {@code this} is a string, or the {@code other} string value if
134-
* {@code this} is null, or is missing, or is of any other non-string type.
137+
* {@code this} value as a {@link DateExpression boolean} if
138+
* {@code this} is a date, or the {@code other} date value if
139+
* {@code this} is null, or is missing, or is of any other non-date type.
135140
*
136141
* @param other the other value.
137142
* @return the resulting value.
@@ -150,7 +155,7 @@ public interface Expression {
150155
* the user is an unchecked assertion that all elements are of that type,
151156
* and that no element is null, is missing, or is of some other type. If the
152157
* user cannot make such an assertion, some appropriate super-type should be
153-
* chosen, and elements should be individually type-checked.
158+
* chosen, and if necessary elements should be individually type-checked.
154159
*
155160
* @param other the other value.
156161
* @return the resulting value.
@@ -164,7 +169,7 @@ public interface Expression {
164169
<T extends Expression> MapExpression<T> isMapOr(MapExpression<T> other);
165170

166171
/**
167-
* The {@link StringExpression string} value corresponding to this value.
172+
* The {@link StringExpression string} representation of {@code this} value.
168173
*
169174
* <p>This may "cause an error" if the type cannot be converted to string,
170175
* as is the case with {@link ArrayExpression arrays},
@@ -182,13 +187,10 @@ public interface Expression {
182187
StringExpression asString();
183188

184189
/**
185-
* Applies the provided function to {@code this}.
190+
* Applies the provided function to {@code this} value.
186191
*
187192
* <p>Equivalent to {@code f.apply(this)}, and allows lambdas and static,
188-
* user-defined functions to use the chaining syntax. For example:
189-
* {@code myInteger.apply(isEven)} (here, {@code isEven} is a function
190-
* taking an {@link IntegerExpression integer} and yielding a
191-
* {@link BooleanExpression boolean}).
193+
* user-defined functions to use the chaining syntax.
192194
*
193195
* @param f the function to apply.
194196
* @return the resulting value.

0 commit comments

Comments
 (0)