当前位置: 首页>>代码示例>>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;未经允许,请勿转载。