Skip to content

Commit 8229b87

Browse files
committed
Add javadoc for boolean, date, number, integer, and expression (#1059)
JAVA-4799
1 parent 0340ae6 commit 8229b87

File tree

6 files changed

+464
-134
lines changed

6 files changed

+464
-134
lines changed

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,41 @@
1919
import java.util.function.Function;
2020

2121
/**
22-
* Expresses a boolean value.
22+
* A logical boolean value, either true or false.
2323
*/
2424
public interface BooleanExpression extends Expression {
2525

2626
/**
27-
* Returns logical true if this expression evaluates to logical false.
28-
* Returns logical false if this expression evaluates to logical true.
27+
* The logical negation of {@code this} value.
2928
*
30-
* @return True if false; false if true.
29+
* @return the resulting value.
3130
*/
3231
BooleanExpression not();
3332

3433
/**
35-
* Returns logical true if this or the other expression evaluates to logical
36-
* true. Returns logical false if both evaluate to logical false.
34+
* The logical conjunction of {@code this} and the {@code other} value.
3735
*
38-
* @param or the other boolean expression.
39-
* @return True if either true, false if both false.
36+
* @param other the other boolean value.
37+
* @return the resulting value.
4038
*/
41-
BooleanExpression or(BooleanExpression or);
39+
BooleanExpression or(BooleanExpression other);
4240

4341
/**
44-
* Returns logical true if both this and the other expression evaluate to
45-
* logical true. Returns logical false if either evaluate to logical false.
42+
* The logical disjunction of {@code this} and the {@code other} value.
4643
*
47-
* @param and the other boolean expression.
48-
* @return true if both true, false if either false.
44+
* @param other the other boolean value.
45+
* @return the resulting value.
4946
*/
50-
BooleanExpression and(BooleanExpression and);
47+
BooleanExpression and(BooleanExpression other);
48+
// TODO-END check the evaluation semantics of and/or
5149

5250
/**
53-
* If this expression evaluates to logical true, returns the result of the
54-
* evaluated left branch expression. If this evaluates to logical false,
55-
* returns the result of the evaluated right branch expression.
51+
* The {@code left} branch when {@code this} is true,
52+
* and the {@code right} branch otherwise.
5653
*
57-
* @param left the left branch expression
58-
* @param right the right branch expression
59-
* @return left if true, right if false.
54+
* @param left the left branch.
55+
* @param right the right branch.
56+
* @return the resulting value.
6057
* @param <T> The type of the resulting expression.
6158
*/
6259
<T extends Expression> T cond(T left, T right);

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

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,113 @@
1919
import java.util.function.Function;
2020

2121
/**
22-
* Expresses a date value.
22+
* An instantaneous date and time. Tracks a UTC datetime, the number of
23+
* milliseconds since the Unix epoch. Does not track the timezone.
2324
*/
2425
public interface DateExpression extends Expression {
26+
27+
/**
28+
* The year of {@code this} date as determined by the provided
29+
* {@code timezone}.
30+
*
31+
* @param timezone the UTC Offset or Olson Timezone Identifier.
32+
* @return the resulting value.
33+
*/
2534
IntegerExpression year(StringExpression timezone);
35+
36+
/**
37+
* The month of {@code this} date as determined by the provided
38+
* {@code timezone}, as an integer between 1 and 12.
39+
*
40+
* @param timezone the UTC Offset or Olson Timezone Identifier.
41+
* @return the resulting value.
42+
*/
2643
IntegerExpression month(StringExpression timezone);
44+
45+
/**
46+
* The day of the month of {@code this} date as determined by the provided
47+
* {@code timezone}, as an integer between 1 and 31.
48+
*
49+
* @param timezone the UTC Offset or Olson Timezone Identifier.
50+
* @return the resulting value.
51+
*/
2752
IntegerExpression dayOfMonth(StringExpression timezone);
53+
54+
/**
55+
* The day of the week of {@code this} date as determined by the provided
56+
* {@code timezone}, as an integer between 1 (Sunday) and 7 (Saturday).
57+
*
58+
* @param timezone the UTC Offset or Olson Timezone Identifier.
59+
* @return the resulting value.
60+
*/
2861
IntegerExpression dayOfWeek(StringExpression timezone);
62+
63+
/**
64+
* The day of the year of {@code this} date as determined by the provided
65+
* {@code timezone}, as an integer between 1 and 366.
66+
*
67+
* @param timezone the UTC Offset or Olson Timezone Identifier.
68+
* @return the resulting value.
69+
*/
2970
IntegerExpression dayOfYear(StringExpression timezone);
71+
72+
/**
73+
* The hour of {@code this} date as determined by the provided
74+
* {@code timezone}, as an integer between 0 and 23.
75+
*
76+
* @param timezone the UTC Offset or Olson Timezone Identifier.
77+
* @return the resulting value.
78+
*/
3079
IntegerExpression hour(StringExpression timezone);
80+
81+
/**
82+
* The minute of {@code this} date as determined by the provided
83+
* {@code timezone}, as an integer between 0 and 59.
84+
*
85+
* @param timezone the UTC Offset or Olson Timezone Identifier.
86+
* @return the resulting value.
87+
*/
3188
IntegerExpression minute(StringExpression timezone);
89+
90+
/**
91+
* The second of {@code this} date as determined by the provided
92+
* {@code timezone}, as an integer between 0 and 59, and 60 in the case
93+
* of a leap second.
94+
*
95+
* @param timezone the UTC Offset or Olson Timezone Identifier.
96+
* @return the resulting value.
97+
*/
3298
IntegerExpression second(StringExpression timezone);
99+
100+
/**
101+
* The week of the year of {@code this} date as determined by the provided
102+
* {@code timezone}, as an integer between 0 and 53.
103+
*
104+
* <p>Weeks begin on Sundays, and week 1 begins with the first Sunday of the
105+
* year. Days preceding the first Sunday of the year are in week 0.
106+
*
107+
* @param timezone the UTC Offset or Olson Timezone Identifier.
108+
* @return the resulting value.
109+
*/
33110
IntegerExpression week(StringExpression timezone);
111+
112+
/**
113+
* The millisecond part of {@code this} date as determined by the provided
114+
* {@code timezone}, as an integer between 0 and 999.
115+
*
116+
* @param timezone the UTC Offset or Olson Timezone Identifier.
117+
* @return the resulting value.
118+
*/
34119
IntegerExpression millisecond(StringExpression timezone);
35120

121+
/**
122+
* The string representation of {@code this} date as determined by the
123+
* provided {@code timezone}, and formatted according to the {@code format}.
124+
*
125+
* @param timezone the UTC Offset or Olson Timezone Identifier.
126+
* @param format the format specifier. TODO-END what standard is this?
127+
* @return the resulting value.
128+
*/
36129
StringExpression asString(StringExpression timezone, StringExpression format);
37130

38131
<R extends Expression> R passDateTo(Function<? super DateExpression, ? extends R> f);

0 commit comments

Comments
 (0)