get Data Method
Lookup a data method by qualified name (for function/action definitions) or by unqualified name (for function/action imports).
If the data method does not exist it indicates a fundamental implementation problem, therefore a non-catchable
PanicException will be thrown, and the app intentionally crashes.
The reason behind this drastic behaviour is to avoid mismatch between server and client.
It is still possible to avoid the PanicException by looking up data methods before calling this method like in the
following code snippet:
- Example checking if a data method exists:
open fun checkDataMethodInCsdlDocumentExistsExample(): kotlin.Unit { val csdlDocument = this.service.metadata; if (csdlDocument.lookupMethods.has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person.UpdatePersonLastName")) { Ignore.valueOf_any(csdlDocument.getDataMethod("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person.UpdatePersonLastName")); } else { // The data method UpdatePersonLastName does not exists, add logic to handle the issue/throw an Exception, etc.. } }
- See Also:
-
{@link com.sap.cloud.mobile.kotlin.odata.csdl.CsdlDocument#dataMethods CsdlDocument.dataMethods}, for looking up methods that might not exist.
Return
The data method, which must exist.
Parameters
name
Name of the data method to be returned.