getValue

abstract fun <T : Any> getValue(propertyName: String, clazz: KClass<T>): T

Returns the value of a specific non-nullable value property.

The class argument must be the KClass of the RealmStorageType for the property.

To retrieve values for nullable, object or list properties use the getNullableValue, getObject and get<X>List variants.

Return

the property value.

Parameters

propertyName

the name of the property to retrieve the value for.

clazz

the Kotlin class of the value. Must match the RealmStorageType.kClass of the property in the realm.

T

the type of the value.

Throws

IllegalArgummentException

if the class doesn't contain a field with the specific name, if clazz doesn't match the property's RealmStorageType.kClass or if trying to retrieve collection properties.