Package com.couchbase.lite
Class Expression
- java.lang.Object
-
- com.couchbase.lite.Expression
-
- Direct Known Subclasses:
MetaExpression,PredictionFunction,PropertyExpression,VariableExpression
public abstract class Expression extends Object
The expression used in constructing a query.
-
-
Constructor Summary
Constructors Constructor Description Expression()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Expressionadd(Expression expression)Create an add expression to add the given expression to the current expressionstatic PropertyExpressionall()Creates a * expression to express all propertiesExpressionand(Expression expression)Create a logical AND expression that performs logical AND operation with the current expression.Expressionbetween(Expression expression1, Expression expression2)Create a between expression that evaluates whether or not the current expression is between the given expressions inclusively.static ExpressionbooleanValue(boolean value)Create value expression with given boolean valueExpressioncollate(Collation collation)Creates a Collate expression with the given Collation specification.static Expressiondate(Date value)Create value expression with given Date valueExpressiondivide(Expression expression)Create a divide expression to divide the current expression by the given expression.static ExpressiondoubleValue(double value)Create value expression with given double valueExpressionequalTo(Expression expression)Create an equal to expression that evaluates whether or not the current expression is equal to the given expression.static ExpressionfloatValue(float value)Create value expression with given float valueExpressiongreaterThan(Expression expression)Create a greater than expression that evaluates whether or not the current expression is greater than the given expression.ExpressiongreaterThanOrEqualTo(Expression expression)Create a greater than or equal to expression that evaluates whether or not the current expression is greater than or equal to the given expression.Expressionin(Expression... expressions)Create an IN expression that evaluates whether or not the current expression is in the given expressions.static ExpressionintValue(int value)Create value expression with given integer valueExpressionis(Expression expression)Create an IS expression that evaluates whether or not the current expression is equal to the given expression.ExpressionisNot(Expression expression)Create an IS NOT expression that evaluates whether or not the current expression is not equal to the given expression.ExpressionisNotValued()Creates an NOT IS VALUED expression that returns true if the current expression is NOT VALUED.ExpressionisNullOrMissing()Deprecated.use Expression.isValuedExpressionisValued()Creates an IS VALUED expression that returns true if the current expression is valued.ExpressionlessThan(Expression expression)Create a less than expression that evaluates whether or not the current expression is less than the given expression.ExpressionlessThanOrEqualTo(Expression expression)Create a less than or equal to expression that evaluates whether or not the current expression is less than or equal to the given expression.Expressionlike(Expression expression)Create a Like expression that evaluates whether or not the current expression is LIKE the given expression.static Expressionlist(List<Object> value)Create value expression with the given list.static ExpressionlongValue(long value)Create value expression with given long valuestatic Expressionmap(Map<String,Object> value)Creates value expression with the given map.Expressionmodulo(Expression expression)Create a modulo expression to modulo the current expression by the given expression.Expressionmultiply(Expression expression)Create a multiply expression to multiply the current expression by the given expression.static Expressionnegated(Expression expression)Create a negated expression to represent the negated result of the given expression.static Expressionnot(Expression expression)Create a negated expression to represent the negated result of the given expression.ExpressionnotEqualTo(Expression expression)Create a NOT equal to expression that evaluates whether or not the current expression is not equal to the given expression.ExpressionnotNullOrMissing()Deprecated.use Expression.isValuedstatic Expressionnumber(Number value)Create value expression with given Number valueExpressionor(Expression expression)Create a logical OR expression that performs logical OR operation with the current expression.static Expressionparameter(String name)Creates a parameter expression with the given parameter name.static PropertyExpressionproperty(String property)Create a property expression representing the value of the given property.Expressionregex(Expression expression)Create a regex match expression that evaluates whether or not the current expression regex matches the given expression.static Expressionstring(String value)Create value expression with given String valueExpressionsubtract(Expression expression)Create a subtract expression to subtract the given expression from the current expression.StringtoString()static Expressionvalue(Object value)Create value expression with given value
-
-
-
Method Detail
-
value
@NonNull public static Expression value(@Nullable Object value)
Create value expression with given value- Parameters:
value- the value- Returns:
- the value expression
-
string
@NonNull public static Expression string(@Nullable String value)
Create value expression with given String value- Parameters:
value- the String value- Returns:
- the value expression
-
number
@NonNull public static Expression number(@Nullable Number value)
Create value expression with given Number value- Parameters:
value- the Number value- Returns:
- the value expression
-
intValue
@NonNull public static Expression intValue(int value)
Create value expression with given integer value- Parameters:
value- the integer value- Returns:
- the value expression
-
longValue
@NonNull public static Expression longValue(long value)
Create value expression with given long value- Parameters:
value- the long value- Returns:
- the value expression
-
floatValue
@NonNull public static Expression floatValue(float value)
Create value expression with given float value- Parameters:
value- the float value- Returns:
- the value expression
-
doubleValue
@NonNull public static Expression doubleValue(double value)
Create value expression with given double value- Parameters:
value- the double value- Returns:
- the value expression
-
booleanValue
@NonNull public static Expression booleanValue(boolean value)
Create value expression with given boolean value- Parameters:
value- the boolean value- Returns:
- the value expression
-
date
@NonNull public static Expression date(@Nullable Date value)
Create value expression with given Date value- Parameters:
value- the Date value- Returns:
- the value expression
-
map
@NonNull public static Expression map(@Nullable Map<String,Object> value)
Creates value expression with the given map.- Parameters:
value- the map value- Returns:
- the value expression.
-
list
@NonNull public static Expression list(@Nullable List<Object> value)
Create value expression with the given list.- Parameters:
value- the list value.- Returns:
- the value expression.
-
all
@NonNull public static PropertyExpression all()
Creates a * expression to express all properties- Returns:
- a property expression.
-
property
@NonNull public static PropertyExpression property(@NonNull String property)
Create a property expression representing the value of the given property.- Parameters:
property- the name of the property in the form of a key path.- Returns:
- a property expression.
-
parameter
@NonNull public static Expression parameter(@NonNull String name)
Creates a parameter expression with the given parameter name.- Parameters:
name- The parameter name- Returns:
- A parameter expression.
-
negated
@NonNull public static Expression negated(@NonNull Expression expression)
Create a negated expression to represent the negated result of the given expression.- Parameters:
expression- the expression to be negated.- Returns:
- a negated expression.
-
not
@NonNull public static Expression not(@NonNull Expression expression)
Create a negated expression to represent the negated result of the given expression.- Parameters:
expression- the expression to be negated.- Returns:
- a negated expression.
-
multiply
@NonNull public Expression multiply(@NonNull Expression expression)
Create a multiply expression to multiply the current expression by the given expression.- Parameters:
expression- the expression to multiply by.- Returns:
- a multiply expression.
-
divide
@NonNull public Expression divide(@NonNull Expression expression)
Create a divide expression to divide the current expression by the given expression.- Parameters:
expression- the expression to divide by.- Returns:
- a divide expression.
-
modulo
@NonNull public Expression modulo(@NonNull Expression expression)
Create a modulo expression to modulo the current expression by the given expression.- Parameters:
expression- the expression to modulo by.- Returns:
- a modulo expression.
-
add
@NonNull public Expression add(@NonNull Expression expression)
Create an add expression to add the given expression to the current expression- Parameters:
expression- an expression to add to the current expression.- Returns:
- an add expression.
-
subtract
@NonNull public Expression subtract(@NonNull Expression expression)
Create a subtract expression to subtract the given expression from the current expression.- Parameters:
expression- an expression to subtract from the current expression.- Returns:
- a subtract expression.
-
lessThan
@NonNull public Expression lessThan(@NonNull Expression expression)
Create a less than expression that evaluates whether or not the current expression is less than the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a less than expression.
-
lessThanOrEqualTo
@NonNull public Expression lessThanOrEqualTo(@NonNull Expression expression)
Create a less than or equal to expression that evaluates whether or not the current expression is less than or equal to the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a less than or equal to expression.
-
greaterThan
@NonNull public Expression greaterThan(@NonNull Expression expression)
Create a greater than expression that evaluates whether or not the current expression is greater than the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a greater than expression.
-
greaterThanOrEqualTo
@NonNull public Expression greaterThanOrEqualTo(@NonNull Expression expression)
Create a greater than or equal to expression that evaluates whether or not the current expression is greater than or equal to the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a greater than or equal to expression.
-
equalTo
@NonNull public Expression equalTo(@NonNull Expression expression)
Create an equal to expression that evaluates whether or not the current expression is equal to the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- an equal to expression.
-
notEqualTo
@NonNull public Expression notEqualTo(@NonNull Expression expression)
Create a NOT equal to expression that evaluates whether or not the current expression is not equal to the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a NOT equal to expression.
-
and
@NonNull public Expression and(@NonNull Expression expression)
Create a logical AND expression that performs logical AND operation with the current expression.- Parameters:
expression- the expression to AND with the current expression.- Returns:
- a logical AND expression.
-
or
@NonNull public Expression or(@NonNull Expression expression)
Create a logical OR expression that performs logical OR operation with the current expression.- Parameters:
expression- the expression to OR with the current expression.- Returns:
- a logical OR expression.
-
like
@NonNull public Expression like(@NonNull Expression expression)
Create a Like expression that evaluates whether or not the current expression is LIKE the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a Like expression.
-
regex
@NonNull public Expression regex(@NonNull Expression expression)
Create a regex match expression that evaluates whether or not the current expression regex matches the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- a regex match expression.
-
is
@NonNull public Expression is(@NonNull Expression expression)
Create an IS expression that evaluates whether or not the current expression is equal to the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- an IS expression.
-
isNot
@NonNull public Expression isNot(@NonNull Expression expression)
Create an IS NOT expression that evaluates whether or not the current expression is not equal to the given expression.- Parameters:
expression- the expression to compare with the current expression.- Returns:
- an IS NOT expression.
-
between
@NonNull public Expression between(@NonNull Expression expression1, @NonNull Expression expression2)
Create a between expression that evaluates whether or not the current expression is between the given expressions inclusively.- Parameters:
expression1- the inclusive lower bound expression.expression2- the inclusive upper bound expression.- Returns:
- a between expression.
-
isNullOrMissing
@Deprecated @NonNull public Expression isNullOrMissing()
Deprecated.use Expression.isValuedCreates an IS NULL OR MISSING expression that evaluates whether or not the current expression is null or missing.- Returns:
- An IS NULL expression.
-
notNullOrMissing
@Deprecated @NonNull public Expression notNullOrMissing()
Deprecated.use Expression.isValuedCreates an IS NOT NULL OR MISSING expression that evaluates whether or not the current expression is NOT null or missing.- Returns:
- An IS NOT NULL expression.
-
isValued
@NonNull public Expression isValued()
Creates an IS VALUED expression that returns true if the current expression is valued.- Returns:
- An IS VALUED expression.
-
isNotValued
@NonNull public Expression isNotValued()
Creates an NOT IS VALUED expression that returns true if the current expression is NOT VALUED.- Returns:
- An IS NOT VALUED expression.
-
collate
@NonNull public Expression collate(@NonNull Collation collation)
Creates a Collate expression with the given Collation specification. Commonly the collate expression is used in the Order BY clause or the string comparison  expression (e.g. equalTo or lessThan) to specify how the two strings are compared.- Parameters:
collation- The collation object.- Returns:
- A Collate expression.
-
in
@NonNull public Expression in(@NonNull Expression... expressions)
Create an IN expression that evaluates whether or not the current expression is in the given expressions.- Parameters:
expressions- the expression array to evaluate with.- Returns:
- an IN expression.
-
-