getEntitySet

open fun getEntitySet(name: String): EntitySet

Lookup an entity set (or singleton entity) by name. If the entity set 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 simplet types before calling this method like in the following code snippet: Note that OData singleton entities are represented by entity sets where {@link com.sap.cloud.mobile.kotlin.odata.EntitySet#isSingleton EntitySet.isSingleton} is true.

Example checking if a entity set exists:
open fun checkEntitySetInCsdlDocumentExistsExample(): kotlin.Unit
{
    val csdlDocument = this.service.metadata;
    if (csdlDocument.entitySets.has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airlines"))
    {
        Ignore.valueOf_any(csdlDocument.getEntitySet("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airlines"));
    }
    else
    {
        // The entity set Airlines does not exists, add logic to handle the issue/throw an Exception, etc..
    }
}
See Also:

{@link com.sap.cloud.mobile.kotlin.odata.csdl.CsdlDocument#entitySets CsdlDocument.entitySets}, for looking up sets that might not exist.

Return

The entity set, which must exist.

Parameters

name

Name of the entity set to be returned.