getRequiredEntity

Return the required entity value of this result.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.QueryResultException} if the result does not have the expected type.

Example using proxy classes:
open fun requiredEntityExample(): kotlin.Unit
{
    val service = this.service;
    val query = DataQuery()
        .select(Customer.customerID, Customer.companyName, Customer.contactName)
        .orderBy(Customer.companyName).top(1);
    val customer = service.getCustomer(query);
    this.showCustomer(customer);
}
Example using dynamic API:
open fun requiredEntityExample(): kotlin.Unit
{
    val service = this.service;
    val customersEntitySet = service.getEntitySet("Customers");
    val customerEntityType = customersEntitySet.entityType;
    val customerIDProperty = customerEntityType.getProperty("CustomerID");
    val companyNameProperty = customerEntityType.getProperty("CompanyName");
    val contactNameProperty = customerEntityType.getProperty("ContactName");
    val query = DataQuery()
        .select(customerIDProperty, companyNameProperty, contactNameProperty)
        .from(customersEntitySet).orderBy(companyNameProperty).top(1);
    val customer = service.executeQuery(query).getRequiredEntity();
    this.showCustomer(customer);
}

Return

The required entity value of this result.