Android Open Source - br.com.mirabilis.sqlite S Q Lite Database File






From Project

Back to project page br.com.mirabilis.sqlite.

License

The source code is released under:

Apache License

If you think the Android project br.com.mirabilis.sqlite listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package br.com.mirabilis.sqlite.manager.util;
/* ww w .  j  a  v a  2 s .  c  o m*/
import java.util.regex.Pattern;

import br.com.mirabilis.sqlite.manager.exception.SQLiteException;

/**
 * Validate name of database;
 * 
 * @author Rodrigo Sim?es Rosa
 */
public class SQLiteDatabaseFile {

  private String database;
  private String path;

  /**
   * Receipt {@link String} that of name from database;
   * 
   * @param databaseName
   * @throws SQLConnectionException
   */
  private SQLiteDatabaseFile(String databaseName) throws SQLiteException {
    if (Pattern.matches("^[a-zA-Z]+$", databaseName)) {
      this.database = databaseName.concat(".db");
    } else {
      throw new SQLiteException("O nome da base de dados ? inv?lido");
    }
  }

  /**
   * Return databaseName;
   * 
   * @return
   */
  public String getDatabase() {
    return database;
  }

  /**
   * Return path;
   * 
   * @return
   */
  public String getPath() {
    return path;
  }

  /**
   * Return absolutePath
   * 
   * @return
   */
  public String getAbsolutePath() {
    if (path != null) {
      return path.concat(database);
    }
    return database;
  }

  /**
   * Builder of {@link SQLiteDatabaseFile}
   * 
   * @author Rodrigo Sim?es Rosa.
   */
  public static class Builder {

    private SQLiteDatabaseFile instance;

    /**
     * Constructor
     * 
     * @param databaseName
     * @throws SQLiteException
     */
    public Builder(String databaseName) throws SQLiteException {
      this.instance = new SQLiteDatabaseFile(databaseName);
    }

    /**
     * Set path of file
     * 
     * @param path
     * @return
     */
    public Builder path(String path) {
      this.instance.path = path;
      return this;
    }

    /**
     * Build {@link SQLiteDatabaseFile}
     * 
     * @return
     */
    public SQLiteDatabaseFile build() {
      return this.instance;
    }
  }
}




Java Source Code List

br.com.mirabilis.sample.BuildConfig.java
br.com.mirabilis.sample.MainActivity.java
br.com.mirabilis.sqlite.BuildConfig.java
br.com.mirabilis.sqlite.BuildConfig.java
br.com.mirabilis.sqlite.annotation.SQLiteParseAnnotation.java
br.com.mirabilis.sqlite.annotation.model.SQLiteAnnotationEntity.java
br.com.mirabilis.sqlite.annotation.model.SQLiteAnnotationField.java
br.com.mirabilis.sqlite.cypher.CypherFileManager.java
br.com.mirabilis.sqlite.manager.core.SQLiteConnection.java
br.com.mirabilis.sqlite.manager.core.SQLiteCore.java
br.com.mirabilis.sqlite.manager.dao.DAO.java
br.com.mirabilis.sqlite.manager.dao.SQLiteDAO.java
br.com.mirabilis.sqlite.manager.dao.util.SQLiteDataManager.java
br.com.mirabilis.sqlite.manager.dao.util.SQLiteDataType.java
br.com.mirabilis.sqlite.manager.exception.SQLiteEmptyException.java
br.com.mirabilis.sqlite.manager.exception.SQLiteException.java
br.com.mirabilis.sqlite.manager.exception.SQLiteNotNullFieldException.java
br.com.mirabilis.sqlite.manager.model.SQLiteEntity.java
br.com.mirabilis.sqlite.manager.model.SQLiteField.java
br.com.mirabilis.sqlite.manager.model.SQLiteTable.java
br.com.mirabilis.sqlite.manager.util.SQLiteDatabaseFile.java
br.com.mirabilis.sqlite.view.SqliteActivity.java