public class QueryFunction
extends java.lang.Object
Represents a OData query function.
Query functions are typically used within DataQuery.filter
.
QueryFunctionCall
can be constructed using static calls on QueryFunction
or, more conveniently, by chained calls on QueryValue
.
public void queryFunctionExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .filter(QueryFunction.contains(QueryFunction.toLower(Customer.address), StringValue.of("king"))); Customer__List customers = service.getCustomers(query); this.showCustomers(customers); }
public void queryValueFunctionExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .filter(Customer.address.toLower().contains("king")); Customer__List customers = service.getCustomers(query); this.showCustomers(customers); }
Modifier and Type | Field and Description |
---|---|
static QueryFunctionMap |
functionMap |
Constructor and Description |
---|
QueryFunction() |
Modifier and Type | Method and Description |
---|---|
static QueryValue |
asType(DataType type)
|
static QueryValue |
asType(DataType type,
DataValue value)
Return a deferred call of the OData 'cast' canonical function.
|
static QueryValue |
ceiling(DataValue value)
Return a deferred call of the OData 'ceiling' canonical function.
|
static QueryValue |
concat(DataValue left,
DataValue right)
Return a deferred call of the OData 'concat' canonical function.
|
static QueryFilter |
contains(DataValue value,
DataValue searchValue)
Return a deferred call of the OData 'contains' canonical function.
|
static QueryValue |
custom(java.lang.String name,
DataValueList arguments)
Return a deferred call of a custom function.
|
static QueryValue |
date(DataValue value)
Return a deferred call of the OData 'date' canonical function.
|
static QueryValue |
day(DataValue value)
Return a deferred call of the OData 'day' canonical function.
|
static QueryFilter |
endsWith(DataValue value,
DataValue suffix)
Return a deferred call of the OData 'endswith' canonical function.
|
static QueryValue |
floor(DataValue value)
Return a deferred call of the OData 'floor' canonical function.
|
static QueryFunction |
forCode(int code)
Lookup a query function by code.
|
static QueryFunction |
forName(java.lang.String name)
Lookup a query function by name.
|
static QueryValue |
fractionalSeconds(DataValue value)
Return a deferred call of the OData 'fractionalseconds' canonical function.
|
static QueryValue |
geoDistance(DataValue from,
DataValue to)
Return a deferred call of the OData 'geo.distance' canonical function.
|
static QueryFilter |
geoIntersects(DataValue point,
DataValue polygon)
Return a deferred call of the OData 'geo.intersects' canonical function.
|
static QueryValue |
geoLength(DataValue value)
Return a deferred call of the OData 'geo.length' canonical function.
|
int |
getCode()
Return function code.
|
int |
getMaxArity()
Return maximum arity (number of arguments).
|
int |
getMinArity()
Return minimum arity (number of arguments).
|
java.lang.String |
getName()
Return function name.
|
static QueryValue |
hour(DataValue value)
Return a deferred call of the OData 'hour' canonical function.
|
static QueryValue |
indexOf(DataValue value,
DataValue searchValue)
Return a deferred call of the OData 'indexof' canonical function.
|
static QueryFilter |
isType(DataType type)
|
static QueryFilter |
isType(DataType type,
DataValue value)
Return a deferred call of the OData 'isof' canonical function.
|
static QueryValue |
maxDateTime()
Return a deferred call of the OData 'maxdatetime' canonical function.
|
static QueryValue |
minDateTime()
Return a deferred call of the OData 'mindatetime' canonical function.
|
static QueryValue |
minute(DataValue value)
Return a deferred call of the OData 'minute' canonical function.
|
static QueryValue |
month(DataValue value)
Return a deferred call of the OData 'month' canonical function.
|
static QueryValue |
now()
Return a deferred call of the OData 'now' canonical function.
|
static QueryValue |
round(DataValue value)
Return a deferred call of the OData 'round' canonical function.
|
static QueryValue |
second(DataValue value)
Return a deferred call of the OData 'second' canonical function.
|
void |
setCode(int value)
Set function code.
|
void |
setMaxArity(int value)
Set maximum arity (number of arguments).
|
void |
setMinArity(int value)
Set minimum arity (number of arguments).
|
void |
setName(java.lang.String value)
Set function name.
|
static QueryFilter |
startsWith(DataValue value,
DataValue prefix)
Return a deferred call of the OData 'startswith' canonical function.
|
static QueryValue |
stringLength(DataValue value)
Return a deferred call of the OData 'length' canonical function.
|
static QueryValue |
substring(DataValue value,
DataValue start)
|
static QueryValue |
substring(DataValue value,
DataValue start,
DataValue length)
Return a deferred call of the OData 'substring' canonical function.
|
static QueryValue |
time(DataValue value)
Return a deferred call of the OData 'time' canonical function.
|
static QueryValue |
toLower(DataValue value)
Return a deferred call of the OData 'tolower' canonical function.
|
java.lang.String |
toString() |
static QueryValue |
totalOffsetMinutes(DataValue value)
Return a deferred call of the OData 'totaloffsetminutes' canonical function.
|
static QueryValue |
toUpper(DataValue value)
Return a deferred call of the OData 'toUpper' canonical function.
|
static QueryValue |
trim(DataValue value)
Return a deferred call of the OData 'trim' canonical function.
|
static QueryValue |
year(DataValue value)
Return a deferred call of the OData 'year' canonical function.
|
public static final QueryFunctionMap functionMap
public static QueryValue asType(DataType type)
type
- Type parameter.public static QueryValue asType(DataType type, DataValue value)
Return a deferred call of the OData 'cast' canonical function.
type
- A data type.value
- (nullable) A data value, or null
to refer to the "current instance".public static QueryValue ceiling(DataValue value)
Return a deferred call of the OData 'ceiling' canonical function.
value
- A number value.public static QueryValue concat(DataValue left, DataValue right)
Return a deferred call of the OData 'concat' canonical function.
left
- Left string value.right
- Right string value.public static QueryFilter contains(DataValue value, DataValue searchValue)
Return a deferred call of the OData 'contains' canonical function.
value
- A string value.searchValue
- To search for in value
.public static QueryValue custom(java.lang.String name, DataValueList arguments)
Return a deferred call of a custom function.
name
- Custom function name.arguments
- Custom function arguments.public static QueryValue date(DataValue value)
Return a deferred call of the OData 'date' canonical function.
value
- A value with date components.public static QueryValue day(DataValue value)
Return a deferred call of the OData 'day' canonical function.
value
- A value with date components.public static QueryFilter endsWith(DataValue value, DataValue suffix)
Return a deferred call of the OData 'endswith' canonical function.
value
- A string value.suffix
- Suffix to check for in value
.public static QueryValue floor(DataValue value)
Return a deferred call of the OData 'floor' canonical function.
value
- A number value.public static QueryFunction forCode(int code)
Lookup a query function by code.
constants.
code
- Function code.public static QueryFunction forName(java.lang.String name)
Lookup a query function by name.
DataQueryException
if name
is not the name of a known query function.
name
- Function name.public static QueryValue fractionalSeconds(DataValue value)
Return a deferred call of the OData 'fractionalseconds' canonical function.
value
- A value with time components.public static QueryValue geoDistance(DataValue from, DataValue to)
Return a deferred call of the OData 'geo.distance' canonical function.
from
- A starting point.to
- An ending point.public static QueryFilter geoIntersects(DataValue point, DataValue polygon)
Return a deferred call of the OData 'geo.intersects' canonical function.
point
- A point.polygon
- A polygon.public static QueryValue geoLength(DataValue value)
Return a deferred call of the OData 'geo.length' canonical function.
value
- A line string or polygon.public int getCode()
Return function code.
public int getMaxArity()
Return maximum arity (number of arguments).
public int getMinArity()
Return minimum arity (number of arguments).
public java.lang.String getName()
Return function name.
public static QueryValue hour(DataValue value)
Return a deferred call of the OData 'hour' canonical function.
value
- A value with time components.public static QueryValue indexOf(DataValue value, DataValue searchValue)
Return a deferred call of the OData 'indexof' canonical function.
value
- A string value.searchValue
- To search for in value
.public static QueryFilter isType(DataType type)
type
- Type parameter.public static QueryFilter isType(DataType type, DataValue value)
Return a deferred call of the OData 'isof' canonical function.
type
- A data type.value
- (nullable) A data value, or null
to refer to the "current instance".public static QueryValue maxDateTime()
Return a deferred call of the OData 'maxdatetime' canonical function.
public static QueryValue minDateTime()
Return a deferred call of the OData 'mindatetime' canonical function.
public static QueryValue minute(DataValue value)
Return a deferred call of the OData 'minute' canonical function.
value
- A value with time components.public static QueryValue month(DataValue value)
Return a deferred call of the OData 'month' canonical function.
value
- A value with date components.public static QueryValue now()
Return a deferred call of the OData 'now' canonical function.
public static QueryValue round(DataValue value)
Return a deferred call of the OData 'round' canonical function.
value
- A number value.public static QueryValue second(DataValue value)
Return a deferred call of the OData 'second' canonical function.
value
- A value with time components.public void setCode(int value)
Set function code.
value
- Function code.public void setMaxArity(int value)
Set maximum arity (number of arguments).
value
- Maximum arity (number of arguments).public void setMinArity(int value)
Set minimum arity (number of arguments).
value
- Minimum arity (number of arguments).public void setName(java.lang.String value)
Set function name.
value
- Function name.public static QueryFilter startsWith(DataValue value, DataValue prefix)
Return a deferred call of the OData 'startswith' canonical function.
value
- A string value.prefix
- Prefix to check for in value
.public static QueryValue stringLength(DataValue value)
Return a deferred call of the OData 'length' canonical function.
value
- A string value.public static QueryValue substring(DataValue value, DataValue start)
value
- Value parameter.start
- Start parameter.public static QueryValue substring(DataValue value, DataValue start, DataValue length)
Return a deferred call of the OData 'substring' canonical function.
value
- A string value.start
- A starting index.length
- (nullable) A substring length.public static QueryValue time(DataValue value)
Return a deferred call of the OData 'time' canonical function.
value
- A value with time components.public static QueryValue toLower(DataValue value)
Return a deferred call of the OData 'tolower' canonical function.
value
- A string value.public java.lang.String toString()
toString
in class java.lang.Object
public static QueryValue toUpper(DataValue value)
Return a deferred call of the OData 'toUpper' canonical function.
value
- A string value.public static QueryValue totalOffsetMinutes(DataValue value)
Return a deferred call of the OData 'totaloffsetminutes' canonical function.
value
- A value with time components.public static QueryValue trim(DataValue value)
Return a deferred call of the OData 'trim' canonical function.
value
- A string value.public static QueryValue year(DataValue value)
Return a deferred call of the OData 'year' canonical function.
value
- A value with date components.