Class TypeExpressions
- java.lang.Object
-
- dev.morphia.aggregation.experimental.expressions.TypeExpressions
-
public final class TypeExpressions extends Object
Defines helper methods for the type expressions- Since:
- 2.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypeExpressions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Expression
convert(Expression input, ConvertType to)
Converts a value to a specified type.static Expression
isNumber(Expression input)
Checks if the specified expression resolves to one of the numeric BSON types.static Expression
toBool(Expression input)
Converts value to a boolean.static Expression
toDate(Expression input)
Converts value to a Date.static Expression
toDecimal(Expression input)
Converts value to a Decimal128.static Expression
toDouble(Expression input)
Converts value to a double.static Expression
toInt(Expression input)
Converts value to an integer.static Expression
toLong(Expression input)
Converts value to a long.static Expression
toObjectId(Expression input)
Converts value to an ObjectId.static Expression
toString(Expression input)
Converts value to a string.static Expression
type(Expression input)
Return the BSON data type of the field.
-
-
-
Method Detail
-
convert
public static Expression convert(Expression input, ConvertType to)
Converts a value to a specified type.- Parameters:
input
- the value to processto
- an expression giving the target type- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $convert
-
isNumber
public static Expression isNumber(Expression input)
Checks if the specified expression resolves to one of the numeric BSON types.- Parameters:
input
- the value to check- Returns:
- the new expression
- Since:
- 2.1
- MongoDB documentation
- Aggregration Expression: $isNumber
-
toBool
public static Expression toBool(Expression input)
Converts value to a boolean.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toBool
-
toDate
public static Expression toDate(Expression input)
Converts value to a Date.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toDate
-
toDecimal
public static Expression toDecimal(Expression input)
Converts value to a Decimal128.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toDecimal
-
toDouble
public static Expression toDouble(Expression input)
Converts value to a double.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toDouble
-
toInt
public static Expression toInt(Expression input)
Converts value to an integer.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toInt
-
toLong
public static Expression toLong(Expression input)
Converts value to a long.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toLong
-
toObjectId
public static Expression toObjectId(Expression input)
Converts value to an ObjectId.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toObjectId
-
toString
public static Expression toString(Expression input)
Converts value to a string.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $toString
-
type
public static Expression type(Expression input)
Return the BSON data type of the field.- Parameters:
input
- the value to process- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $type
-
-