Here my Realm object
public class LocalizedString extends RealmObject {
private RealmList<TranslatedString> translations = new RealmList<>();
public RealmList<TranslatedString> getTranslations() {
return translations;
}
}
I want to create this schema by Realm Studio
So here screenshots:

But I get error:

Why I can't create properties RealmList<TranslatedString> translations ?
You need to untick "Allow null values in the list".
It is not possible to support nullability of RealmList elements in linked type.
If I untick "Allow null values in the list" then result model will be:
public class LocalizedString extends RealmObject {
@Required
private RealmList<String> translations;
public RealmList<String> getTranslations() { return translations; }
public void setTranslations(RealmList<String> translations) { this.translations = translations; }
}
But I need the property translations to not be @Required.
How I can do this?
Hold on, then the type you specify should be RealmList<String>, not RealmList<TranslatedString>....
It's unpossible because all our android and iphone clients use this model: not required property translations
RealmList<T extends RealmModel> does not support null elements.
It's unclear what exactly you are trying to accomplish as @Zhuinden said, there is a big difference between your list having String or TranslatedString in your model class. String values can be null but references to other TranslatedString cannot.
But we should update Realm Studio so you cannot change the nullability state for RealmModel references
I use Realm Studio: Version 1.18.5.
I need to create the next POJO
public class LocalizedString extends RealmObject {
private RealmList<TranslatedString> translations = new RealmList<>();
}
public class TranslatedString extends RealmObject {
@Required
private String locale;
@Required
private String value;
}
How I can do this by Realm Studio (ver. 1.18.5) ?
In that case, RealmList<TranslatedString> cannot contain null elements.
Realm Studio has been updated to no longer show invalid combinations for the nullability flag. This should be part of the next release.