本文整理汇总了Java中io.realm.RealmList类的典型用法代码示例。如果您正苦于以下问题:Java RealmList类的具体用法?Java RealmList怎么用?Java RealmList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealmList类属于io.realm包,在下文中一共展示了RealmList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ChatListFragment
import io.realm.RealmList; //导入依赖的package包/类
public ChatListFragment() {
contactUpdatedListener = new ResultListener() {
@Override
public void onResult(boolean success) {
if (success) {
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (chatInfoList != null) {
if (chatInfoList.size() > 0) {
RealmList<RealmContact> phoneContacts = AppManager.getContacts(getActivity());
adapter.setPhoneContacts(phoneContacts);
adapter.notifyDataSetChanged();
}
}
}
});
}
}
}
};
}
示例2: getFieldStringListNull
import io.realm.RealmList; //导入依赖的package包/类
public RealmList<String> getFieldStringListNull() {
return fieldStringListNull;
}
示例3: deserialize
import io.realm.RealmList; //导入依赖的package包/类
@Override
public RealmList<T> deserialize(JsonElement json, Type typeOfT,
JsonDeserializationContext context) throws JsonParseException {
RealmList<T> items = new RealmList<>();
JsonArray ja = json.getAsJsonArray();
for (JsonElement je : ja) {
items.add((T) context.deserialize(je, getObjectType()));
}
return items;
}
示例4: initList
import io.realm.RealmList; //导入依赖的package包/类
private void initList() {
mList = new RealmList<>();
mList.add(new GoldManagerItemBean(0, true));
mList.add(new GoldManagerItemBean(1, true));
mList.add(new GoldManagerItemBean(2, true));
mList.add(new GoldManagerItemBean(3, true));
mList.add(new GoldManagerItemBean(4, false));
mList.add(new GoldManagerItemBean(5, false));
mList.add(new GoldManagerItemBean(6, false));
mList.add(new GoldManagerItemBean(7, false));
}
示例5: Season
import io.realm.RealmList; //导入依赖的package包/类
public Season(String id, String name, boolean hasFullSeasonDownloadUrl, RealmList<Episode> episodes, TvShow tvShow) {
mId = id;
mName = name;
mHasFullSeasonDownloadUrl = hasFullSeasonDownloadUrl;
mEpisodes = episodes;
mTvShow = tvShow;
}
示例6: parse
import io.realm.RealmList; //导入依赖的package包/类
@Test
public void parse() throws Exception {
String json = TestUtil.getCatWithListOfFriendsJson();
Type catRealmListType = new TypeToken<RealmList<Cat>>(){}.getType();
CatListConverter catRealmListConverter = new CatListConverter();
Gson gson = new GsonBuilder()
.registerTypeAdapter(catRealmListType, catRealmListConverter)
.create();
Cat cat = gson.fromJson(json, Cat.class);
Assert.assertNotNull(cat);
Assert.assertNotNull(cat.friends);
}
示例7: from
import io.realm.RealmList; //导入依赖的package包/类
@Override
public <E> Flowable<RealmList<E>> from(Realm realm, final RealmList<E> list) {
final RealmConfiguration realmConfig = realm.getConfiguration();
return Flowable.create(new FlowableOnSubscribe<RealmList<E>>() {
@Override
public void subscribe(final FlowableEmitter<RealmList<E>> emitter) throws Exception {
// Gets instance to make sure that the Realm is open for as long as the
// Observable is subscribed to it.
final Realm observableRealm = Realm.getInstance(realmConfig);
listRefs.get().acquireReference(list);
final RealmChangeListener<RealmList<E>> listener = new RealmChangeListener<RealmList<E>>() {
@Override
public void onChange(RealmList<E> results) {
if (!emitter.isCancelled()) {
emitter.onNext(list);
}
}
};
list.addChangeListener(listener);
// Cleanup when stream is disposed
emitter.setDisposable(Disposables.fromRunnable(new Runnable() {
@Override
public void run() {
list.removeChangeListener(listener);
observableRealm.close();
listRefs.get().releaseReference(list);
}
}));
// Emit current value immediately
emitter.onNext(list);
}
}, BACK_PRESSURE_STRATEGY);
}
示例8: changesetsFrom
import io.realm.RealmList; //导入依赖的package包/类
@Override
public <E> Observable<CollectionChange<RealmList<E>>> changesetsFrom(DynamicRealm realm, final RealmList<E> list) {
final RealmConfiguration realmConfig = realm.getConfiguration();
return Observable.create(new ObservableOnSubscribe<CollectionChange<RealmList<E>>>() {
@Override
public void subscribe(final ObservableEmitter<CollectionChange<RealmList<E>>> emitter) throws Exception {
// Gets instance to make sure that the Realm is open for as long as the
// Observable is subscribed to it.
final DynamicRealm observableRealm = DynamicRealm.getInstance(realmConfig);
listRefs.get().acquireReference(list);
final OrderedRealmCollectionChangeListener<RealmList<E>> listener = new OrderedRealmCollectionChangeListener<RealmList<E>>() {
@Override
public void onChange(RealmList<E> results, OrderedCollectionChangeSet changeSet) {
if (!emitter.isDisposed()) {
emitter.onNext(new CollectionChange<>(results, changeSet));
}
}
};
list.addChangeListener(listener);
// Cleanup when stream is disposed
emitter.setDisposable(Disposables.fromRunnable(new Runnable() {
@Override
public void run() {
list.removeChangeListener(listener);
observableRealm.close();
listRefs.get().releaseReference(list);
}
}));
// Emit current value immediately
emitter.onNext(new CollectionChange<>(list, null));
}
});
}
示例9: parse
import io.realm.RealmList; //导入依赖的package包/类
@Override
public RealmList<T> parse(JsonParser jsonParser) throws IOException {
init();
RealmList<T> list = new RealmList<>();
if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
T object = typeConverter != null ? typeConverter.parse(jsonParser) : mapper.parse(jsonParser);
if (object != null) {
list.add(object);
}
}
}
return list;
}
示例10: makeDefaultGsonBuilder
import io.realm.RealmList; //导入依赖的package包/类
public static GsonBuilder makeDefaultGsonBuilder() {
return new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC)
.disableHtmlEscaping()
.setPrettyPrinting()
.registerTypeAdapter(Date.class, new DateDeserializer())
.registerTypeAdapter(new TypeToken<RealmList<RealmString>>() {}.getType(), new RealmStringDeserializer());
}
示例11: saveContacts
import io.realm.RealmList; //导入依赖的package包/类
/**
* save contacts data into local storage
* @param contacts
*/
public static void saveContacts(final RealmList<RealmContact> contacts ){
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
final RealmResults<RealmContact> results = realm.where(RealmContact.class).findAll();
results.deleteAllFromRealm();
realm.copyToRealmOrUpdate(contacts);
realm.commitTransaction();
}
示例12: fromParcel
import io.realm.RealmList; //导入依赖的package包/类
@Override
public RealmList fromParcel(Parcel parcel) {
int size = parcel.readInt();
if (size != -1) {
RealmList list = new RealmList();
for (int i = 0; i < size; i++) {
Parcelable parcelable = parcel.readParcelable(getClass().getClassLoader());
list.add((RealmObject) Parcels.unwrap(parcelable));
}
return list;
}
return null;
}
示例13: setFieldLongListNull
import io.realm.RealmList; //导入依赖的package包/类
public void setFieldLongListNull(RealmList<Long> fieldLongListNull) {
this.fieldLongListNull = fieldLongListNull;
}
示例14: setFieldShortListNull
import io.realm.RealmList; //导入依赖的package包/类
public void setFieldShortListNull(RealmList<Short> fieldShortListNull) {
this.fieldShortListNull = fieldShortListNull;
}
示例15: setRoles
import io.realm.RealmList; //导入依赖的package包/类
public void setRoles(RealmList<Role> roles) {
this.roles = roles;
}