Package com.mendix.datastorage
Interface XPathQuery
- All Superinterfaces:
XPathBasicQuery
,XPathQueryBase
Fluent API for basic or schema-based XPath queries.
Can be used to create and execute XPath queries in a fluent manner. For example:
public getObjectsWithValue(IContext context, ICore core, int value) {
List<IMendixObject> results = core.createXPathQuery("//Entity[attribute=$value]")
.setVariable("value", 1)
.setAmount(500)
.setOffset(50)
.setDepth(1)
.execute(context);
return results;
}
After the XPath query is built up, XPathQueryBase.execute(IContext)
can be called to retrieve the results.
XPath string functions contains
, starts-with
and ends-with
do not support
variables as their second argument.
- Since:
- Mendix 7.17
-
Method Summary
Modifier and TypeMethodDescriptionsetRetrievalSchema
(IRetrievalSchema schema) Adds a retrieval schema to the query.setVariable
(String name, boolean value) Sets the value of the specified variable of type Boolean.setVariable
(String name, double value) Sets the value of the specified variable to type Decimal.setVariable
(String name, int value) Sets the value of the specified variable of type Integer.setVariable
(String name, long value) Sets the value of the specified variable of type Long.setVariable
(String name, IMendixIdentifier identifier) Sets the value of the specified variable of type (Mendix) Object.setVariable
(String name, IMendixObject object) Sets the value of the specified variable of type (Mendix) Object.setVariable
(String name, String value) Sets the value of the specified variable of type String.setVariable
(String name, BigDecimal value) Sets the value of the specified variable of type Decimal.setVariable
(String name, Collection<?> values) Sets the value of the specified variable of type List.Methods inherited from interface com.mendix.datastorage.XPathBasicQuery
addSort, setAmount, setDepth, setOffset
Methods inherited from interface com.mendix.datastorage.XPathQueryBase
execute, executeAggregateDouble, executeAggregateLong, executeRaw
-
Method Details
-
setRetrievalSchema
Adds a retrieval schema to the query.- Parameters:
schema
- the schema to apply- Returns:
- the instance of
XPathSchemaQuery
that can be used to construct an XPath query with schema
-
setVariable
Sets the value of the specified variable of type Decimal.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalue
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type Boolean.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalue
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable to type Decimal.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalue
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type Integer.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalue
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type Long.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalue
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type (Mendix) Object.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setobject
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type (Mendix) Object.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setidentifier
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type String.- Specified by:
setVariable
in interfaceXPathBasicQuery
- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalue
- the value to set- Returns:
- the updated query
-
setVariable
Sets the value of the specified variable of type List.- Specified by:
setVariable
in interfaceXPathQueryBase
- Parameters:
name
- the name of the variable to setvalues
- the value to set- Returns:
- the updated query
-