Class TypeExpressions
- java.lang.Object
-
- dev.morphia.aggregation.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 dev.morphia.aggregation.expressions.impls.Expression
convert(dev.morphia.aggregation.expressions.impls.Expression input, dev.morphia.aggregation.expressions.impls.ConvertType to)
Converts a value to a specified type.static dev.morphia.aggregation.expressions.impls.Expression
isNumber(dev.morphia.aggregation.expressions.impls.Expression input)
Checks if the specified expression resolves to one of the numeric BSON types.static dev.morphia.aggregation.expressions.impls.Expression
toBool(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to a boolean.static dev.morphia.aggregation.expressions.impls.Expression
toDate(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to a Date.static dev.morphia.aggregation.expressions.impls.Expression
toDecimal(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to a Decimal128.static dev.morphia.aggregation.expressions.impls.Expression
toDouble(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to a double.static dev.morphia.aggregation.expressions.impls.Expression
toInt(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to an integer.static dev.morphia.aggregation.expressions.impls.Expression
toLong(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to a long.static dev.morphia.aggregation.expressions.impls.Expression
toObjectId(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to an ObjectId.static dev.morphia.aggregation.expressions.impls.Expression
toString(dev.morphia.aggregation.expressions.impls.Expression input)
Converts value to a string.static dev.morphia.aggregation.expressions.impls.Expression
type(dev.morphia.aggregation.expressions.impls.Expression input)
Return the BSON data type of the field.
-
-
-
Method Detail
-
convert
public static dev.morphia.aggregation.expressions.impls.Expression convert(dev.morphia.aggregation.expressions.impls.Expression input, dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression isNumber(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toBool(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toDate(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toDecimal(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toDouble(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toInt(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toLong(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toObjectId(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression toString(dev.morphia.aggregation.expressions.impls.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 dev.morphia.aggregation.expressions.impls.Expression type(dev.morphia.aggregation.expressions.impls.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
-
-