java 一个独立的Java应用程序,用于为Android创建OrmLite的配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 一个独立的Java应用程序,用于为Android创建OrmLite的配置相关的知识,希望对你有一定的参考价值。

public class OrmLiteConfigurationApp extends OrmLiteConfigUtil{

    /**
     * classes represents the models to use for generating the ormlite_config.txt file
     */
    private static final Class<?>[] classes = new Class[] {TimeEntries.class};

    /**
     * Given that this is a separate program from the android app, we have to use
     * a static main java method to create the configuration file.
     * @param args
     * @throws IOException
     * @throws SQLException
     */
    public static void main(String[] args) throws IOException, SQLException {

        String currDirectory = "user.dir";

        String configPath = "/app/src/main/res/raw/ormlite_config.txt";

        /**
         * Gets the project root directory
         */
        String projectRoot = System.getProperty(currDirectory);

        /**
         * Full configuration path includes the project root path, and the location
         * of the ormlite_config.txt file appended to it
         */
        String fullConfigPath = projectRoot + configPath;

        File configFile = new File(fullConfigPath);

        /**
         * In the a scenario where we run this program serveral times, it will recreate the
         * configuration file each time with the updated configurations.
         */
        if(configFile.exists()) {
            configFile.delete();
            configFile = new File(fullConfigPath);
        }

        /**
         * writeConfigFile is a util method used to write the necessary configurations
         * to the ormlite_config.txt file.
         */
        writeConfigFile(configFile, classes);
    }
}

以上是关于java 一个独立的Java应用程序,用于为Android创建OrmLite的配置的主要内容,如果未能解决你的问题,请参考以下文章

没有可用于配置选项的 Java 编译器 compilerClassName: [null] and compiler: [null]

hdu 1068 Girls and Boys (最大独立集)

没有浏览器的 SAML 和 Java 独立应用程序?

Java-GC机制

Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.Str

Java多线程