Wirelessly building a library by reflection
Using the reflection mechanism of Java, we can get a list of the methods in the object, the parameter list and the corresponding values.
1. Model Layer
Database Layer DAO
Business Tiers
Database base class Base
2. Implementation steps
(1) Write a database helper class
1) Define the interface to enable reflection to be invoked, perform read and write operations
2) Use the singleton mode to construct the private construction method first, then judge
(2) Create an entity class, where the property is a field in the datasheet
The method of constructing table, updating, writing and adding and adding and deleting in DAO layer
(3)
In base class base, the Config class declares the database name, the database name
Defines a private construction method used by the outside world to instantiate objects directly using new
Returns the database name, returns the database version
(4) Materialized Reflection tool class
(5) View
View in Ddms, data/data/package name/databases/database name
Using the reflection mechanism to create a SQLite database