@@ -92,72 +92,73 @@ public Expr expr() {
9292 * @return new instance of {@link Expr}.
9393 */
9494 public LastObservationCarriedForward locf () {
95- return usesFieldRef () ? LastObservationCarriedForward .locfValueOf (fieldReference ) : LastObservationCarriedForward .locfValueOf (expression );
95+ return usesFieldRef () ? LastObservationCarriedForward .locfValueOf (fieldReference )
96+ : LastObservationCarriedForward .locfValueOf (expression );
97+ }
98+
99+ private boolean usesFieldRef () {
100+ return fieldReference != null ;
101+ }
102+ }
103+
104+ /**
105+ * Allows the use of aggregation expressions within the query language.
106+ */
107+ public static class Expr extends AbstractAggregationExpression {
108+
109+ private Expr (Object value ) {
110+ super (value );
111+ }
112+
113+ @ Override
114+ protected String getMongoMethod () {
115+ return "$expr" ;
96116 }
97117
98118 /**
99- * Allows the use of aggregation expressions within the query language.
119+ * Creates new {@link Expr}.
120+ *
121+ * @param fieldReference must not be {@literal null}.
122+ * @return new instance of {@link Expr}.
100123 */
101- public static class Expr extends AbstractAggregationExpression {
102-
103- private Expr (Object value ) {
104- super (value );
105- }
106-
107- @ Override
108- protected String getMongoMethod () {
109- return "$expr" ;
110- }
111-
112- /**
113- * Creates new {@link Expr}.
114- *
115- * @param fieldReference must not be {@literal null}.
116- * @return new instance of {@link Expr}.
117- */
118- public static Expr valueOf (String fieldReference ) {
119-
120- Assert .notNull (fieldReference , "FieldReference must not be null" );
121- return new Expr (Fields .field (fieldReference ));
122- }
123-
124- /**
125- * Creates new {@link Expr}.
126- *
127- * @param expression must not be {@literal null}.
128- * @return new instance of {@link Expr}.
129- */
130- public static Expr valueOf (AggregationExpression expression ) {
131-
132- Assert .notNull (expression , "Expression must not be null" );
133- return new Expr (expression );
134- }
135-
136- /**
137- * Creates {@code $expr} as {@link CriteriaDefinition}.
138- *
139- * @return the {@link CriteriaDefinition} from this expression.
140- */
141- public CriteriaDefinition toCriteriaDefinition (AggregationOperationContext context ) {
142-
143- Document criteriaObject = toDocument (context );
144-
145- return new CriteriaDefinition () {
146- @ Override
147- public Document getCriteriaObject () {
148- return criteriaObject ;
149- }
150-
151- @ Override
152- public String getKey () {
153- return getMongoMethod ();
154- }
155- };
156- }
124+ public static Expr valueOf (String fieldReference ) {
125+
126+ Assert .notNull (fieldReference , "FieldReference must not be null" );
127+ return new Expr (Fields .field (fieldReference ));
157128 }
158129
159- private boolean usesFieldRef () {
160- return fieldReference != null ;
130+ /**
131+ * Creates new {@link Expr}.
132+ *
133+ * @param expression must not be {@literal null}.
134+ * @return new instance of {@link Expr}.
135+ */
136+ public static Expr valueOf (AggregationExpression expression ) {
137+
138+ Assert .notNull (expression , "Expression must not be null" );
139+ return new Expr (expression );
140+ }
141+
142+ /**
143+ * Creates {@code $expr} as {@link CriteriaDefinition}.
144+ *
145+ * @return the {@link CriteriaDefinition} from this expression.
146+ */
147+ public CriteriaDefinition toCriteriaDefinition (AggregationOperationContext context ) {
148+
149+ Document criteriaObject = toDocument (context );
150+
151+ return new CriteriaDefinition () {
152+ @ Override
153+ public Document getCriteriaObject () {
154+ return criteriaObject ;
155+ }
156+
157+ @ Override
158+ public String getKey () {
159+ return getMongoMethod ();
160+ }
161+ };
161162 }
162163 }
163164
0 commit comments