Class Expressions
- java.lang.Object
-
- dev.morphia.aggregation.experimental.expressions.Expressions
-
public final class Expressions extends Object
Defines helper methods for various expressions.- Since:
- 2.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Expression
field(String name)
Creates a field expression for the given value.static Expression
literal(Object value)
Returns a value without parsing.static Expression
meta()
Returns the metadata associated with a document in a pipeline operations, e.g.static DocumentExpression
of()
Creates a new DocumentExpression.static <T> List<T>
toList(T first, T... additional)
static Expression
value(Object value)
Returns a value without parsing.
-
-
-
Method Detail
-
field
public static Expression field(String name)
Creates a field expression for the given value. If the value does not already start with '$', it will be prepended automatically.- Parameters:
name
- the field name- Returns:
- the new expression
-
literal
public static Expression literal(Object value)
Returns a value without parsing. Use for values that the aggregation pipeline may interpret as an expression.- Parameters:
value
- the value- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $literal
-
meta
public static Expression meta()
Returns the metadata associated with a document in a pipeline operations, e.g. "textScore" when performing text search.- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $meta
-
of
public static DocumentExpression of()
Creates a new DocumentExpression.- Returns:
- the new expression
-
toList
public static <T> List<T> toList(T first, T... additional)
- Type Parameters:
T
- the element type- Parameters:
first
- the first itemadditional
- additional items- Returns:
- a list of them all
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
value
public static Expression value(Object value)
Returns a value without parsing. Note that this is different fromliteral(Object)
in that the given value will dropped directly in to the pipeline for use/evaluation in whatever context the value is used.- Parameters:
value
- the value- Returns:
- the new expression
-
-