getValueList

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

Returns the list of non-nullable value elements referenced by the property name as a RealmList.

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

The following snippet outlines the different functions available for the different list types:

// Retrieve a list of nullable ints from a 'nullableIntList' property
dynamicRealmObject.getNullableValueList("nullableIntList", Int::class)

// Retrieve a list of non-nullable ints from a 'intList' property
dynamicRealmObject.getValueList("intList", Int::class)

// Retrieve a list of objects from an `objectList' property
// Object lists are ALWAYS non-nullable
dynamicRealmObject.getObjectList("objectList", DynamicRealmObject::class)

Return

the referenced RealmList

Parameters

propertyName

the name of the list property to retrieve the list for.

clazz

the Kotlin class of the list element type.

T

the type of the list element type.

Throws

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