当前位置: 首页>>代码示例>>Java>>正文


Java LitePalParser类代码示例

本文整理汇总了Java中org.litepal.parser.LitePalParser的典型用法代码示例。如果您正苦于以下问题:Java LitePalParser类的具体用法?Java LitePalParser怎么用?Java LitePalParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LitePalParser类属于org.litepal.parser包,在下文中一共展示了LitePalParser类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildConnection

import org.litepal.parser.LitePalParser; //导入依赖的package包/类
/**
 * Build a connection to the database. This progress will analysis the
 * litepal.xml file, and will check if the fields in LitePalAttr are valid,
 * and it will open a SQLiteOpenHelper to decide to create tables or update
 * tables or doing nothing depends on the version attributes.
 * 
 * After all the stuffs above are finished. This method will return a
 * LitePalHelper object.Notes this method could throw a lot of exceptions.
 * 
 * @return LitePalHelper object.
 * 
 * @throws org.litepal.exceptions.InvalidAttributesException
 * @throws ParseConfigurationFileException
 */
private static LitePalOpenHelper buildConnection() {
	if (mLitePalAttr == null) {
		LitePalParser.parseLitePalConfiguration();
		mLitePalAttr = LitePalAttr.getInstance();
	}
	if (mLitePalAttr.checkSelfValid()) {
		if (mLitePalHelper == null) {
			mLitePalHelper = new LitePalOpenHelper(mLitePalAttr.getDbName(),
					mLitePalAttr.getVersion());
		}
		return mLitePalHelper;
	} else {
		throw new InvalidAttributesException("Uncaught invalid attributes exception happened");
	}
}
 
开发者ID:ownwell,项目名称:zztinews,代码行数:30,代码来源:Connector.java

示例2: isDefaultDatabase

import org.litepal.parser.LitePalParser; //导入依赖的package包/类
/**
 * Check the dbName is default database or not. If it's same as dbName in litepal.xml, then it is
 * default database.
 * @param dbName
 *          Name of database to check.
 * @return True if it's default database, false otherwise.
 */
private static boolean isDefaultDatabase(String dbName) {
    if (BaseUtility.isLitePalXMLExists()) {
        if (!dbName.endsWith(Const.Config.DB_NAME_SUFFIX)) {
            dbName = dbName + Const.Config.DB_NAME_SUFFIX;
        }
        LitePalConfig config = LitePalParser.parseLitePalConfiguration();
        String defaultDbName = config.getDbName();
        if (!defaultDbName.endsWith(Const.Config.DB_NAME_SUFFIX)) {
            defaultDbName = defaultDbName + Const.Config.DB_NAME_SUFFIX;
        }
        return dbName.equalsIgnoreCase(defaultDbName);
    }
    return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:LitePal.java

示例3: fromDefault

import org.litepal.parser.LitePalParser; //导入依赖的package包/类
/**
 * Construct a LitePalDB instance from the default configuration by litepal.xml. But database
 * name must be different than the default.
 * @param dbName
 *          Name of database.
 * @return A LitePalDB instance which used the default configuration in litepal.xml but with a specified database name.
 */
public static LitePalDB fromDefault(String dbName) {
    LitePalConfig config = LitePalParser.parseLitePalConfiguration();
    LitePalDB litePalDB = new LitePalDB(dbName, config.getVersion());
    litePalDB.setStorage(config.getStorage());
    litePalDB.setClassNames(config.getClassNames());
    return litePalDB;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:LitePalDB.java


注:本文中的org.litepal.parser.LitePalParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。