setOptionalValue

fun setOptionalValue(property: Property, value: DataValue?)

Set the optional value of a specified property. If a null value is provided and the property does not permit null values ({@link com.sap.cloud.mobile.kotlin.odata.Property#isNullable Property.isNullable} is false), then this is equivalent to calling unsetDataValue, otherwise it is equivalent to calling setDataValue.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.core.CastException} if the property value does not have the expected type.

Parameters

property

The specified property.

value

(nullable) The property value (or null), using the appropriate subclass of {@link com.sap.cloud.mobile.kotlin.odata.DataValue}.