本文整理匯總了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;
}