當前位置: 首頁>>代碼示例>>Java>>正文


Java Realm.isClosed方法代碼示例

本文整理匯總了Java中io.realm.Realm.isClosed方法的典型用法代碼示例。如果您正苦於以下問題:Java Realm.isClosed方法的具體用法?Java Realm.isClosed怎麽用?Java Realm.isClosed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.realm.Realm的用法示例。


在下文中一共展示了Realm.isClosed方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openLocalInstance

import io.realm.Realm; //導入方法依賴的package包/類
/**
 * Opens a reference-counted local Realm instance.
 *
 * @return the open Realm instance
 */
public Realm openLocalInstance() {
    checkDefaultConfiguration();
    Realm realm = Realm.getDefaultInstance(); // <-- consider adding parameter and Map<RealmConfiguration, ...>
    Realm localRealm = localRealms.get();
    if(localRealm == null || localRealm.isClosed()) {
        localRealms.set(realm);
    }
    return realm;
}
 
開發者ID:Zhuinden,項目名稱:realm-helpers,代碼行數:15,代碼來源:RealmManager.java

示例2: getLocalInstance

import io.realm.Realm; //導入方法依賴的package包/類
/**
 * Returns the local Realm instance without adding to the reference count.
 *
 * @return the local Realm instance
 * @throws IllegalStateException when no Realm is open
 */
public Realm getLocalInstance() {
    Realm realm = localRealms.get();
    if(realm == null || realm.isClosed()) {
        throw new IllegalStateException(
                "No open Realms were found on this thread.");
    }
    return realm;
}
 
開發者ID:Zhuinden,項目名稱:realm-helpers,代碼行數:15,代碼來源:RealmManager.java

示例3: closeLocalInstance

import io.realm.Realm; //導入方法依賴的package包/類
/**
 * Closes local Realm instance, decrementing the reference count.
 *
 * @throws IllegalStateException if there is no open Realm.
 */
public void closeLocalInstance() {
    checkDefaultConfiguration();
    Realm realm = localRealms.get();
    if(realm == null || realm.isClosed()) {
        throw new IllegalStateException(
                "Cannot close a Realm that is not open.");
    }
    realm.close();
    // noinspection ConstantConditions
    if(Realm.getLocalInstanceCount(Realm.getDefaultConfiguration()) <= 0) {
        localRealms.set(null);
    }
}
 
開發者ID:Zhuinden,項目名稱:realm-helpers,代碼行數:19,代碼來源:RealmManager.java

示例4: openRealm

import io.realm.Realm; //導入方法依賴的package包/類
public Realm openRealm() {
  Realm realm = realms.get();
  if (realm != null && !realm.isClosed()) {
    throw new IllegalStateException("Realm is already open");
  }
  realm = Realm.getDefaultInstance();
  realms.set(realm);
  return realm;
}
 
開發者ID:goutfeb,項目名稱:ElephantAsia,代碼行數:10,代碼來源:RealmManager.java

示例5: closeRealm

import io.realm.Realm; //導入方法依賴的package包/類
public void closeRealm() {
  Realm realm = realms.get();
  if (realm == null) {
    throw new IllegalStateException("No Realm found to close");
  }
  if (!realm.isClosed()) {
    realm.close();
  }
  realms.set(null);
}
 
開發者ID:goutfeb,項目名稱:ElephantAsia,代碼行數:11,代碼來源:RealmManager.java

示例6: isClosed

import io.realm.Realm; //導入方法依賴的package包/類
public static boolean isClosed(Realm realm) {
    if (realm == null) {
        return true;
    } else if (realm.isClosed()) {
        return true;
    }
    return false;
}
 
開發者ID:Jusenr,項目名稱:androidgithub,代碼行數:9,代碼來源:DBManager.java

示例7: checkRealmValid

import io.realm.Realm; //導入方法依賴的package包/類
private void checkRealmValid(Realm realm) {
    if(realm == null || realm.isClosed()) {
        throw new IllegalStateException("Unexpected state: Realm is not open");
    }
}
 
開發者ID:Zhuinden,項目名稱:realm-monarchy,代碼行數:6,代碼來源:Monarchy.java

示例8: close

import io.realm.Realm; //導入方法依賴的package包/類
public static void close(Realm realm) {
    if (realm != null && !realm.isClosed()) {
        realm.close();
    }
}
 
開發者ID:Jusenr,項目名稱:androidgithub,代碼行數:6,代碼來源:DBManager.java

示例9: isAutoRefresh

import io.realm.Realm; //導入方法依賴的package包/類
public static void isAutoRefresh(Realm realm) {
    if (realm != null && !realm.isClosed()) {
        realm.isAutoRefresh();
    }
}
 
開發者ID:Jusenr,項目名稱:androidgithub,代碼行數:6,代碼來源:DBManager.java


注:本文中的io.realm.Realm.isClosed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。