Interface XPathQuery
- All Superinterfaces:
XPathBasicQuery,XPathQueryBase
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.
- Since:
- Mendix 7.17
-
Method Summary
Modifier and TypeMethodDescriptionsetRetrievalSchema(IRetrievalSchema schema) Adds a retrieval schema to the query.setVariable(String name, boolean value) Sets a variable with a value of typeBooleansetVariable(String name, double value) Sets a variable with a value of typeDoublesetVariable(String name, int value) Sets a variable with a value of typeIntegersetVariable(String name, long value) Sets a variable with a value of typeLongsetVariable(String name, IMendixIdentifier identifier) Sets a variable with a value of typeIMendixIdentifiersetVariable(String name, IMendixObject object) Sets a variable with a value of typeIMendixObjectsetVariable(String name, String value) Sets a variable with a value of typeStringsetVariable(String name, BigDecimal value) Sets a variable with a value of typeBigDecimalMethods inherited from interface com.mendix.datastorage.XPathBasicQuery
addSort, setAmount, setDepth, setOffsetMethods inherited from interface com.mendix.datastorage.XPathQueryBase
execute
-
Method Details
-
setRetrievalSchema
Adds a retrieval schema to the query.- Parameters:
schema- the schema to apply.- Returns:
- the instance of
XPathSchemaQuerythat can be use to construct an XPath query with schema
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeBigDecimalAdds a
BigDecimalvariable In XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.value- variable that represents a literalBigDecimalvalue- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeBooleanIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.value- variable that represents a literalBooleanvalue- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeDoubleIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.value- variable that represents a literalDoublevalue- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeIntegerIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.value- variable that represents a literalIntegervalue- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeLongIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.value- variable that represents a literalLongvalue- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeIMendixObjectIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.object- variable that represents aIMendixObjectvalue. Will be replaced by it's identifier in the query- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeIMendixIdentifierIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.identifier- variable that represents an identifier of an object- Returns:
- the updated query instance
-
setVariable
Description copied from interface:XPathQueryBaseSets a variable with a value of typeStringIn XPath queries it is possible to add variables Variable can be denoted with '$', e.g. a valid query syntax could be '//Entity.Ref[field >= $limit]'.
- Specified by:
setVariablein interfaceXPathBasicQuery- Specified by:
setVariablein interfaceXPathQueryBase- Parameters:
name- name of variables referenced in the expression (without '$') and their values.value- variable that represents a literalStringvalue- Returns:
- the updated query instance
-