获取对象

摘要 覆盖 乐趣 getObjectSet(propertyName : string): RealmSet<DynamicMutableRealmObject>

RealmSet的形式返回属性名称引用的对象集。

class参数必须是属性的 RealmStorageType 的KClass

以下代码段概述了可用于不同集类型的不同函数:

// 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)

返回

引用的RealmSet

参数

属性 名称

要为其检索集合的集合属性的名称。

抛出异常

如果类不包含具有特定名称的字段,如果尝试检索未设置的属性的值,或者如果clazz与属性的RealmStorageType.kClass不匹配。