<标签 vnc客户端>
sqliteGen 是一个为 AndroID 开发人员准备的 Eclipse 插件,用来自动生成 sqlite 数据库的访问类,使用 Annotation 方式。
项目主页:http://code.google.com/p/sqlitegen/
项目下载地址:http://code.google.com/p/sqlitegen/downloads/list
在项目主页,说明了如何使用及安装该插件。
首先需要在下载页面下载两个文件:
sqlitegen_eclipse_site_xxx.jar,这个文件以jar的形式包含了Eclipse插件安装站点。以安装Eclipse插件方式进行安装。
com.antlersoft.androID.db_xxx.jar ,库文件,在AndroID项目里build path 进行导入。
使用插件:
这个插件只工作在AndroID项目。在androID项目上右键单击,选择sqliteGen...
ExampleThis code:
/** * copyright (C) 2009 Michael A. MacDonald */package androID.androIDVNC;import com.antlersoft.androID.db.*;@tableInterface(ImplementingClassname = "AbstractConnectionBean",tablename = "CONNECTION_BEAN")interface IConnectionBean { @FIEldAccessor long get_ID(); @FIEldAccessor String getNickname(); @FIEldAccessor String getAddress(); @FIEldAccessor int getPort(); @FIEldAccessor String getpassword(); @FIEldAccessor String getcolorModel(); @FIEldAccessor boolean getForceFull(); @FIEldAccessor String getRepeaterID();}
generates this file:
// Do not edit this file directly package androID.androIDVNC;public abstract class AbstractConnectionBean extends com.antlersoft.androID.dbimpl.IDImplementationBase implements IConnectionBean { public static final String GEN_table_name = "CONNECTION_BEAN"; public static final int GEN_COUNT = 8; // FIEld constants public static final String GEN_FIELD__ID = "_ID"; public static final int GEN_ID__ID = 0; public static final String GEN_FIELD_NICKname = "NICKname"; public static final int GEN_ID_NICKname = 1; public static final String GEN_FIELD_ADDRESS = "ADDRESS"; public static final int GEN_ID_ADDRESS = 2; public static final String GEN_FIELD_PORT = "PORT"; public static final int GEN_ID_PORT = 3; public static final String GEN_FIELD_PASSWORD = "PASSWORD"; public static final int GEN_ID_PASSWORD = 4; public static final String GEN_FIELD_colorMODEL = "colorMODEL"; public static final int GEN_ID_colorMODEL = 5; public static final String GEN_FIELD_FORCEFulL = "FORCEFulL"; public static final int GEN_ID_FORCEFulL = 6; public static final String GEN_FIELD_REPEATERID = "REPEATERID"; public static final int GEN_ID_REPEATERID = 7; // sql Command for creating the table public static String GEN_CREATE = "CREATE table CONNECTION_BEAN (" + "_ID INTEGER PRIMARY KEY autoINCREMENT," + "NICKname TEXT," + "ADDRESS TEXT," + "PORT INTEGER," + "PASSWORD TEXT," + "colorMODEL TEXT," + "FORCEFulL INTEGER," + "REPEATERID TEXT" + ")"; // Members corresponding to defined fIElds private long gen__ID; private java.lang.String gen_nickname; private java.lang.String gen_address; private int gen_port; private java.lang.String gen_password; private java.lang.String gen_colorModel; private boolean gen_forceFull; private java.lang.String gen_repeaterID; public String Gen_tablename() { return GEN_table_name; } // FIEld accessors public long get_ID() { return gen__ID; } public voID set_ID(long arg__ID) { gen__ID = arg__ID; } public java.lang.String getNickname() { return gen_nickname; } public voID setNickname(java.lang.String arg_nickname) { gen_nickname = arg_nickname; } public java.lang.String getAddress() { return gen_address; } public voID setAddress(java.lang.String arg_address) { gen_address = arg_address; } public int getPort() { return gen_port; } public voID setPort(int arg_port) { gen_port = arg_port; } public java.lang.String getpassword() { return gen_password; } public voID setPassword(java.lang.String arg_password) { gen_password = arg_password; } public java.lang.String getcolorModel() { return gen_colorModel; } public voID setcolorModel(java.lang.String arg_colorModel) { gen_colorModel = arg_colorModel; } public boolean getForceFull() { return gen_forceFull; } public voID setForceFull(boolean arg_forceFull) { gen_forceFull = arg_forceFull; } public java.lang.String getRepeaterID() { return gen_repeaterID; } public voID setRepeaterID(java.lang.String arg_repeaterID) { gen_repeaterID = arg_repeaterID; } public androID.content.ContentValues Gen_getValues() { androID.content.ContentValues values = new androID.content.ContentValues(); values.put(GEN_FIELD__ID,Long.toString(this.gen__ID)); values.put(GEN_FIELD_NICKname,this.gen_nickname); values.put(GEN_FIELD_ADDRESS,this.gen_address); values.put(GEN_FIELD_PORT,Integer.toString(this.gen_port)); values.put(GEN_FIELD_PASSWORD,this.gen_password); values.put(GEN_FIELD_colorMODEL,this.gen_colorModel); values.put(GEN_FIELD_FORCEFulL,(this.gen_forceFull ? "1" : "0")); values.put(GEN_FIELD_REPEATERID,this.gen_repeaterID); return values; } /** * * Return an array that gives the column index in the cursor for each * fIEld defined * @param cursor Database cursor over some columns,possibly * including this table * @return array of column indices; -1 if the column * with that ID is not in cursor */ public int[] Gen_columnIndices(androID.database.Cursor cursor) { int[] result = new int[GEN_COUNT]; result[0] = cursor.getColumnIndex(GEN_FIELD__ID); result[1] = cursor.getColumnIndex(GEN_FIELD_NICKname); result[2] = cursor.getColumnIndex(GEN_FIELD_ADDRESS); result[3] = cursor.getColumnIndex(GEN_FIELD_PORT); result[4] = cursor.getColumnIndex(GEN_FIELD_PASSWORD); result[5] = cursor.getColumnIndex(GEN_FIELD_colorMODEL); result[6] = cursor.getColumnIndex(GEN_FIELD_FORCEFulL); result[7] = cursor.getColumnIndex(GEN_FIELD_REPEATERID); return result; } /** * Populate one instance from a cursor * */ public voID Gen_populate(androID.database.Cursor cursor,int[] columnIndices) { if (columnIndices[GEN_ID__ID] >= 0 && !cursor.isNull(columnIndices[GEN_ID__ID])) { gen__ID = cursor.getLong(columnIndices[GEN_ID__ID]); } if (columnIndices[GEN_ID_NICKname] >= 0 && !cursor.isNull(columnIndices[GEN_ID_NICKname])) { gen_nickname = cursor.getString(columnIndices[GEN_ID_NICKname]); } if (columnIndices[GEN_ID_ADDRESS] >= 0 && !cursor.isNull(columnIndices[GEN_ID_ADDRESS])) { gen_address = cursor.getString(columnIndices[GEN_ID_ADDRESS]); } if (columnIndices[GEN_ID_PORT] >= 0 && !cursor.isNull(columnIndices[GEN_ID_PORT])) { gen_port = (int) cursor.getInt(columnIndices[GEN_ID_PORT]); } if (columnIndices[GEN_ID_PASSWORD] >= 0 && !cursor.isNull(columnIndices[GEN_ID_PASSWORD])) { gen_password = cursor.getString(columnIndices[GEN_ID_PASSWORD]); } if (columnIndices[GEN_ID_colorMODEL] >= 0 && !cursor.isNull(columnIndices[GEN_ID_colorMODEL])) { gen_colorModel = cursor.getString(columnIndices[GEN_ID_colorMODEL]); } if (columnIndices[GEN_ID_FORCEFulL] >= 0 && !cursor.isNull(columnIndices[GEN_ID_FORCEFulL])) { gen_forceFull = (cursor.getInt(columnIndices[GEN_ID_FORCEFulL]) != 0); } if (columnIndices[GEN_ID_REPEATERID] >= 0 && !cursor.isNull(columnIndices[GEN_ID_REPEATERID])) { gen_repeaterID = cursor.getString(columnIndices[GEN_ID_REPEATERID]); } } /** * Populate one instance from a ContentValues * */ public voID Gen_populate(androID.content.ContentValues values) { gen__ID = values.getAsLong(GEN_FIELD__ID); gen_nickname = values.getAsstring(GEN_FIELD_NICKname); gen_address = values.getAsstring(GEN_FIELD_ADDRESS); gen_port = (int) values.getAsInteger(GEN_FIELD_PORT); gen_password = values.getAsstring(GEN_FIELD_PASSWORD); gen_colorModel = values.getAsstring(GEN_FIELD_colorMODEL); gen_forceFull = (values.getAsInteger(GEN_FIELD_FORCEFulL) != 0); gen_repeaterID = values.getAsstring(GEN_FIELD_REPEATERID); }}总结
以上是内存溢出为你收集整理的SqliteGen——自动生成 SQLite 数据库的访问类全部内容,希望文章能够帮你解决SqliteGen——自动生成 SQLite 数据库的访问类所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)