getNullableValueSet

abstract fun <T : Any> getNullableValueSet(propertyName: String, clazz: KClass<T>): RealmSet<T?>

Returns the set of nullable elements referenced by the property name as a RealmSet.

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

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

// Retrieve a set of nullable ints from a 'nullableIntSet' property
dynamicRealmObject.getNullableValueSet("nullableIntSet", Int::class)

// Retrieve a set of non-nullable ints from a 'intSet' property
dynamicRealmObject.getValueSet("intSet", Int::class)

// Retrieve a set of objects from an `objectSet' property
// Object sets are ALWAYS non-nullable
dynamicRealmObject.getObjectSet("objectSet", DynamicRealmObject::class)

Return

the referenced RealmSet

Parameters

propertyName

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

clazz

the Kotlin class of the set element type.

T

the type of the set element type.

Throws

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