FunctionExpression

public class FunctionExpression extends Expression


This class defines the base class for Firestore Pipeline functions, which can be evaluated within pipeline execution.

Typically, you would not use this class or its children directly. Use either the functions like and, equal, or the methods on Expression (Expression.equal), Expression.lessThan, etc) to construct new FunctionExpression instances.

Summary

Public methods

boolean
equals(Object other)
int

Inherited methods

From com.google.firebase.firestore.pipeline.Expression
final @NonNull Expression
abs()

Creates an expression that returns the absolute value of this expression.

final @NonNull Expression

Creates an expression that adds this numeric expression to another numeric expression.

final @NonNull Expression
add(@NonNull Number second)

Creates an expression that adds this numeric expression to a constants.

@NonNull AliasedExpression

Assigns an alias to this expression.

final @NonNull AggregateFunction

Creates an aggregation that collects all values of this expression across multiple stage inputs into an array.

final @NonNull AggregateFunction

Creates an aggregation that collects all distinct values of this expression across multiple stage inputs into an array.

final @NonNull Expression
arrayConcat(@NonNull Object secondArray, @NonNull Object otherArrays)

Creates an expression that concatenates a field's array value with other arrays.

final @NonNull Expression
arrayConcat(@NonNull Expression secondArray, @NonNull Object otherArrays)

Creates an expression that concatenates a field's array value with other arrays.

final @NonNull BooleanExpression

Creates an expression that checks if array contains a specific element.

final @NonNull BooleanExpression

Creates an expression that checks if array contains a specific element.

final @NonNull BooleanExpression

Creates an expression that checks if array contains all elements of arrayExpression.

final @NonNull BooleanExpression

Creates an expression that checks if array contains all the specified values.

final @NonNull BooleanExpression

Creates an expression that checks if array contains any elements of arrayExpression.

final @NonNull BooleanExpression

Creates an expression that checks if array contains any of the specified values.

final @NonNull Expression

Creates an expression that returns the first element of an array expression.

final @NonNull Expression

Creates an expression that returns the first N elements of an array expression.

final @NonNull Expression
arrayFirstN(int n)

Creates an expression that returns the first N elements of an array expression.

final @NonNull Expression

Creates an expression that indexes into an array from the beginning or end and return the element.

final @NonNull Expression
arrayGet(int offset)

Creates an expression that indexes into an array from the beginning or end and return the element.

final @NonNull Expression

Creates an expression that returns the first index where the specified value occurs in the array.

final @NonNull Expression

Creates an expression that returns a list of all indices where the specified value occurs in the array.

final @NonNull Expression

Creates an expression that returns the last element of an array expression.

final @NonNull Expression

Creates an expression that returns the last index where the specified value occurs in the array.

final @NonNull Expression

Creates an expression that returns the last N elements of an array expression.

final @NonNull Expression
arrayLastN(int n)

Creates an expression that returns the last N elements of an array expression.

final @NonNull Expression

Creates an expression that calculates the length of an array expression.

final @NonNull Expression

Creates an expression that returns the maximum value of an array expression.

final @NonNull Expression

Creates an expression that returns the first n largest elements of the array.

final @NonNull Expression

Creates an expression that returns the first n largest elements of the array.

final @NonNull Expression

Creates an expression that returns the minimum value of an array expression.

final @NonNull Expression

Creates an expression that returns the first n smallest elements of the array.

final @NonNull Expression

Creates an expression that returns the first n smallest elements of the array.

final @NonNull Expression

Reverses the order of elements in the array.

final @NonNull Expression

Creates an expression that returns the sum of the elements in this array expression.

final @NonNull BooleanExpression

Casts the expression to a BooleanExpression.

final @NonNull Ordering

Create an Ordering that sorts documents in ascending order based on value of this expression

final @NonNull AggregateFunction

Creates an aggregation that calculates the average (mean) of this numeric expression across multiple stage inputs.

final @NonNull Expression
bitAnd(@NonNull byte[] bitsOther)

Creates an expression that applies a bitwise AND operation with a constant.

final @NonNull Expression

Creates an expression that applies a bitwise AND operation with other expression.

final @NonNull Expression
bitLeftShift(int number)

Creates an expression that applies a bitwise left shift operation with a constant.

final @NonNull Expression

Creates an expression that applies a bitwise left shift operation with an expression.

final @NonNull Expression

Creates an expression that applies a bitwise NOT operation to this expression.

final @NonNull Expression
bitOr(@NonNull byte[] bitsOther)

Creates an expression that applies a bitwise OR operation with a constant.

final @NonNull Expression
bitOr(@NonNull Expression bitsOther)

Creates an expression that applies a bitwise OR operation with other expression.

final @NonNull Expression
bitRightShift(int number)

Creates an expression that applies a bitwise right shift operation with a constant.

final @NonNull Expression

Creates an expression that applies a bitwise right shift operation with an expression.

final @NonNull Expression
bitXor(@NonNull byte[] bitsOther)

Creates an expression that applies a bitwise XOR operation with a constant.

final @NonNull Expression

Creates an expression that applies a bitwise XOR operation with an expression.

final @NonNull Expression

Creates an expression that calculates the length of a string in UTF-8 bytes, or just the length of a Blob.

final @NonNull Expression

Creates an expression that returns the smallest integer that isn't less than this numeric expression.

final @NonNull Expression

Creates an expression that calculates the character length of this string expression in UTF8.

final @NonNull Expression
coalesce(@NonNull Object replacement, @NonNull Object others)

Creates an expression that returns the first non-null, non-absent argument, without evaluating the rest of the arguments.

final @NonNull Expression

Creates an expression that returns the collection ID from this path expression.

final @NonNull Expression
concat(@NonNull Object second, @NonNull Object others)

Creates an expression that concatenates this expression's value with others.

final @NonNull Expression
concat(@NonNull Expression second, @NonNull Object others)

Creates an expression that concatenates this expression's value with others.

final @NonNull Expression
cosineDistance(@NonNull double[] vector)

Calculates the Cosine distance between this vector expression and a vector literal.

final @NonNull Expression

Calculates the Cosine distance between this and another vector expressions.

final @NonNull Expression

Calculates the Cosine distance between this vector expression and a vector literal.

final @NonNull AggregateFunction

Creates an aggregation that counts the number of stage inputs with valid evaluations of the this expression.

final @NonNull AggregateFunction

Creates an aggregation that counts the number of distinct values of an expression across multiple stage inputs.

final @NonNull Ordering

Create an Ordering that sorts documents in descending order based on value of this expression

final @NonNull Expression

Creates an expression that divides this numeric expression by another numeric expression.

final @NonNull Expression
divide(@NonNull Number divisor)

Creates an expression that divides this numeric expression by a constant.

final @NonNull Expression

Creates an expression that returns the document ID from this path expression.

final @NonNull Expression
dotProduct(@NonNull double[] vector)

Calculates the dot product distance between this vector expression and a vector literal.

final @NonNull Expression

Calculates the dot product distance between this and another vector expression.

final @NonNull Expression

Calculates the dot product distance between this vector expression and a vector literal.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression ends with a given suffix.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression ends with a given suffix.

final @NonNull BooleanExpression

Creates an expression that checks if this and other expression are equal.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is equal to a value.

final @NonNull BooleanExpression
equalAny(@NonNull Expression arrayExpression)

Creates an expression that checks if this expression, when evaluated, is equal to any of the elements of arrayExpression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression, when evaluated, is equal to any of the provided values.

final @NonNull Expression
euclideanDistance(@NonNull double[] vector)

Calculates the Euclidean distance between this vector expression and a vector literal.

final @NonNull Expression

Calculates the Euclidean distance between this and another vector expression.

final @NonNull Expression

Calculates the Euclidean distance between this vector expression and a vector literal.

final @NonNull BooleanExpression

Creates an expression that checks if this expression evaluates to a name of the field that exists.

final @NonNull Expression
exp()

Creates an expression that returns Euler's number e raised to the power of this expression.

final @NonNull AggregateFunction

Creates an aggregation that finds the first value of this expression across multiple stage inputs.

final @NonNull Expression

Creates an expression that returns the largest integer that is not greater than this numeric expression.

final @NonNull Expression

Accesses a field/property of a document or Map using the provided key.

final @NonNull Expression
getField(@NonNull Expression keyExpression)

Accesses a field/property of a document or Map using the provided keyExpression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than a value.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than or equal to the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is greater than or equal to a value.

final @NonNull Expression

Creates an expression that returns the elseExpr argument if this expression is absent, else return the result of this expression.

final @NonNull Expression
ifAbsent(@NonNull Object elseValue)

Creates an expression that returns the elseValue argument if this expression is absent, else return the result of this expression.

final @NonNull Expression

Creates an expression that returns the catchExpr argument if there is an error, else return the result of this expression.

final @NonNull Expression
ifError(@NonNull Object catchValue)

Creates an expression that returns the catchValue argument if there is an error, else return the result of this expression.

final @NonNull Expression
ifNull(@NonNull Expression elseExpression)

Creates an expression that returns the elseExpression argument if this expression evaluates to null, else return the result of this expression.

final @NonNull Expression
ifNull(@NonNull Object elseValue)

Creates an expression that returns the elseValue argument if this expression evaluates to null, else return the result of this expression.

final @NonNull BooleanExpression

Creates an expression that returns true if the result of this expression is absent.

final @NonNull BooleanExpression

Creates an expression that checks if this expression produces an error.

final @NonNull BooleanExpression

Creates an expression that checks if the result of this expression is of the given type.

final @NonNull Expression
join(@NonNull String delimiter)

Creates an expression that joins the elements of an array into a string.

final @NonNull Expression
join(@NonNull Expression delimiterExpression)

Creates an expression that joins the elements of an array into a string.

final @NonNull AggregateFunction

Creates an aggregation that finds the last value of this expression across multiple stage inputs.

final @NonNull Expression

Creates an expression that calculates the length of a string, array, map, vector, or blob expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than a value.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than or equal to the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is less than or equal to a value.

final @NonNull BooleanExpression

Creates an expression that performs a case-sensitive wildcard string comparison.

final @NonNull BooleanExpression
like(@NonNull String pattern)

Creates an expression that performs a case-sensitive wildcard string comparison.

final @NonNull Expression
ln()

Creates an expression that returns the natural logarithm of this numeric expression.

final @NonNull Expression

Creates an expression that returns the base-10 logarithm of this numeric expression.

final @NonNull Expression

Creates an expression that returns the largest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that returns the largest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that returns the smallest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that returns the smallest value between multiple input expressions or literal values.

final @NonNull Expression

Creates an expression that removes leading whitespace from this string expression.

final @NonNull Expression
ltrimValue(@NonNull Expression valuesToTrim)

Creates an expression that removes a set of leading values from this string expression.

final @NonNull Expression
ltrimValue(@NonNull String valuesToTrim)

Creates an expression that removes a set of leading values from this string expression.

final @NonNull Expression

Creates an expression that returns the entries of this map expression as an array of maps, where each map contains a "k" property for the key and a "v" property for the value.

final @NonNull Expression

Accesses a map (object) value using the provided key.

final @NonNull Expression
mapGet(@NonNull Expression keyExpression)

Accesses a map (object) value using the provided keyExpression.

final @NonNull Expression

Creates an expression that returns the keys of this map expression.

final @NonNull Expression
mapMerge(@NonNull Expression mapExpr, @NonNull Expression otherMaps)

Creates an expression that merges multiple maps into a single map.

final @NonNull Expression

Creates an expression that removes a key from this map expression.

final @NonNull Expression
mapRemove(@NonNull Expression keyExpression)

Creates an expression that removes a key from this map expression.

final @NonNull Expression
mapSet(
    @NonNull Expression key,
    @NonNull Expression value,
    @NonNull Expression moreKeyValues
)

Creates an expression that returns a new map with the specified entries added or updated.

final @NonNull Expression
mapSet(@NonNull String key, Object value, @NonNull Object moreKeyValues)

Creates an expression that returns a new map with the specified entries added or updated.

final @NonNull Expression

Creates an expression that returns the values of this map expression.

final @NonNull AggregateFunction

Creates an aggregation that finds the maximum value of this expression across multiple stage inputs.

final @NonNull AggregateFunction

Creates an aggregation that finds the minimum value of this expression across multiple stage inputs.

final @NonNull Expression

Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by another numeric expression.

final @NonNull Expression
mod(@NonNull Number divisor)

Creates an expression that calculates the modulo (remainder) of dividing this numeric expressions by a constant.

final @NonNull Expression

Creates an expression that multiplies this numeric expression with another numeric expression.

final @NonNull Expression

Creates an expression that multiplies this numeric expression with a constant.

final @NonNull BooleanExpression

Creates an expression that checks if this expressions is not equal to the other expression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression is not equal to a value.

final @NonNull BooleanExpression
notEqualAny(@NonNull Expression arrayExpression)

Creates an expression that checks if this expression, when evaluated, is not equal to all the elements of arrayExpression.

final @NonNull BooleanExpression

Creates an expression that checks if this expression, when evaluated, is not equal to all the provided values.

final @NonNull Expression

Creates an expression that returns the parent document reference of this document reference expression.

final @NonNull Expression
pow(@NonNull Expression exponent)

Creates an expression that returns this numeric expression raised to the power of the exponent.

final @NonNull Expression
pow(@NonNull Number exponent)

Creates an expression that returns this numeric expression raised to the power of the exponent.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified regular expression as a substring.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified regular expression as a substring.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression matches a specified regular expression.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression matches a specified regular expression.

final @NonNull Expression

Creates an expression that reverses this string expression.

final @NonNull Expression

Creates an expression that rounds this numeric expression to nearest integer.

final @NonNull Expression

Creates an expression that rounds off this numeric expression to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative.

final @NonNull Expression
roundToPrecision(int decimalPlace)

Creates an expression that rounds off this numeric expression to decimalPlace decimal places if decimalPlace is positive, rounds off digits to the left of the decimal point if decimalPlace is negative.

final @NonNull Expression

Creates an expression that removes trailing whitespace from this string expression.

final @NonNull Expression
rtrimValue(@NonNull Expression valuesToTrim)

Creates an expression that removes a set of trailing values from this string expression.

final @NonNull Expression
rtrimValue(@NonNull String valuesToTrim)

Creates an expression that removes a set of trailing characters from this string expression.

final @NonNull Expression
split(@NonNull Blob delimiter)

Creates an expression that splits this blob expression by a blob delimiter.

final @NonNull Expression
split(@NonNull Expression delimiter)

Creates an expression that splits this string or blob expression by a delimiter.

final @NonNull Expression
split(@NonNull String delimiter)

Creates an expression that splits this string or blob expression by a string delimiter.

final @NonNull Expression

Creates an expression that returns the square root of this numeric expression.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression starts with a given prefix.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression starts with a given prefix.

final @NonNull Expression
stringConcat(@NonNull Expression stringExpressions)

Creates an expression that concatenates string expressions together.

final @NonNull Expression

Creates an expression that concatenates string expressions and string constants together.

final @NonNull Expression

Creates an expression that concatenates this string expression with string constants.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified substring.

final @NonNull BooleanExpression

Creates an expression that checks if this string expression contains a specified substring.

final @NonNull Expression

Creates an expression that returns the 0-based index of the first occurrence of the specified substring.

final @NonNull Expression

Creates an expression that returns the 0-based index of the first occurrence of the specified substring.

final @NonNull Expression

Creates an expression that repeats this string expression a given number of times.

final @NonNull Expression
stringRepeat(int count)

Creates an expression that repeats this string expression a given number of times.

final @NonNull Expression
stringReplaceAll(
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)

Creates an expression that replaces all occurrences of a substring with another string.

final @NonNull Expression
stringReplaceAll(@NonNull String oldValue, @NonNull String newValue)

Creates an expression that replaces all occurrences of a substring with another string.

final @NonNull Expression
stringReplaceOne(
    @NonNull Expression oldValue,
    @NonNull Expression newValue
)

Creates an expression that replaces the first occurrence of a substring with another string.

final @NonNull Expression
stringReplaceOne(@NonNull String oldValue, @NonNull String newValue)

Creates an expression that replaces the first occurrence of a substring with another string.

final @NonNull Expression

Creates an expression that performs a reverse operation on this string expression.

final @NonNull Expression

Creates an expression that returns a substring of the given string.

final @NonNull Expression
substring(int start, int length)

Creates an expression that returns a substring of the given string.

final @NonNull Expression

Creates an expression that subtracts a constant from this numeric expression.

final @NonNull Expression
subtract(@NonNull Number subtrahend)

Creates an expression that subtracts a numeric expressions from this numeric expression.

final @NonNull AggregateFunction
sum()

Creates an aggregation that calculates the sum of this numeric expression across multiple stage inputs.

final @NonNull Expression

Creates an expression that adds a specified amount of time to this timestamp expression.

final @NonNull Expression
timestampAdd(@NonNull String unit, long amount)

Creates an expression that adds a specified amount of time to this timestamp expression.

final @NonNull Expression

Calculates the difference between this timestamp and another timestamp.

final @NonNull Expression

Calculates the difference between this timestamp and another timestamp.

final @NonNull Expression
timestampDiff(@NonNull String startFieldName, @NonNull String unit)

Calculates the difference between this timestamp and another timestamp.

final @NonNull Expression

Creates an expression that extracts a specified part from this timestamp expression.

final @NonNull Expression

Creates an expression that extracts a specified part from this timestamp expression.

final @NonNull Expression

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

final @NonNull Expression
timestampExtractWithTimezone(
    @NonNull Expression part,
    @NonNull String timezone
)

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

final @NonNull Expression
timestampExtractWithTimezone(
    @NonNull String part,
    @NonNull Expression timezone
)

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

final @NonNull Expression
timestampExtractWithTimezone(
    @NonNull String part,
    @NonNull String timezone
)

Creates an expression that extracts a specified part from this timestamp expression in a given timezone.

final @NonNull Expression

Creates an expression that subtracts a specified amount of time to this timestamp expression.

final @NonNull Expression
timestampSubtract(@NonNull String unit, long amount)

Creates an expression that subtracts a specified amount of time to this timestamp expression.

final @NonNull Expression

Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC).

final @NonNull Expression

Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC).

final @NonNull Expression

Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC).

final @NonNull Expression

Creates an expression that truncates this timestamp expression to a specified granularity.

final @NonNull Expression

Creates an expression that truncates this timestamp expression to a specified granularity.

final @NonNull Expression
timestampTruncateWithTimezone(
    @NonNull Expression granularity,
    @NonNull Expression timezone
)

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

final @NonNull Expression
timestampTruncateWithTimezone(
    @NonNull Expression granularity,
    @NonNull String timezone
)

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

final @NonNull Expression
timestampTruncateWithTimezone(
    @NonNull String granularity,
    @NonNull Expression timezone
)

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

final @NonNull Expression
timestampTruncateWithTimezone(
    @NonNull String granularity,
    @NonNull String timezone
)

Creates an expression that truncates this timestamp expression to a specified granularity in a given timezone.

final @NonNull Expression

Creates an expression that converts this string expression to lowercase.

final @NonNull Expression

Creates an expression that converts this string expression to uppercase.

final @NonNull Expression

Creates an expression that removes leading and trailing whitespace from this string expression.

final @NonNull Expression

Creates an expression that removes a set of leading and trailing values from this expression.

final @NonNull Expression
trimValue(@NonNull String valueToTrim)

Creates an expression that removes a set of leading and trailing values from this string expression.

final @NonNull Expression

Creates an expression that truncates this numeric expression to an integer.

final @NonNull Expression

Creates an expression that truncates this numeric expression to decimalPlace decimal places if decimalPlace is positive, truncates digits to the left of the decimal point if decimalPlace is negative.

final @NonNull Expression
truncToPrecision(int decimalPlace)

Creates an expression that truncates this numeric expression to decimalPlace decimal places if decimalPlace is positive, truncates digits to the left of the decimal point if decimalPlace is negative.

final @NonNull Expression

Creates an expression that returns a string indicating the type of the value this expression evaluates to.

final @NonNull Expression

Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.

final @NonNull Expression

Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.

final @NonNull Expression

Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp.

final @NonNull Expression

Creates an expression that calculates the length (dimension) of a Firestore Vector.

Public methods

equals

public boolean equals(Object other)

hashCode

public int hashCode()